aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_entity.cpp
Commit message (Expand)AuthorAge
* Fix damage wraparound if very high damage (#11872)Wuzzy2022-01-06
* Add on_deactivate callback for luaentities (#10723)hecks2021-01-02
* Expose collision information to LuaEntity on_stepsfan52020-04-27
* Move the clamping of hp/breath when their maximums change to read_object_prop...Beha2019-07-30
* Consistent HP and damage types (#8167)SmallJoker2019-02-10
* Modernize lua read (part 2 & 3): C++ templating assurance (#7410)Loïc Blot2018-06-30
* Allow damage for attached objects, add attach/detach callbacks (#6786)SmallJoker2018-04-30
* on_death: Fix callback number of pushed arguments (Fixes #6451)SmallJoker2017-09-21
* Add LuaEntity on_death callback (#6177)Loïc Blot2017-07-27
* [CSM] Add event on_place_node API lua (#5548)Vincent Glize2017-04-29
* Hardware coloring for itemstacksDániel Juhász2017-04-08
* Tell on_punch to expect a return valueDuane Robertson2017-02-01
* Make entity on_punch have same signature and behaviour as player on_punchsapier2017-01-28
* Push error handler afresh each time lua_pcall is usedKahrl2015-08-27
* SAPI: Track last executed mod and include in error messageskwolekr2015-08-12
* Improve Script CPP API diagnosticskwolekr2015-08-05
* Fix object reference pushing functions when called from coroutinesShadowNinja2014-10-07
* Use "core" namespace internallyShadowNinja2014-05-08
* Only push the Lua error handler onceShadowNinja2014-04-27
* Pass a errfunc to lua_pcall to get a tracebackShadowNinja2013-11-15
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
* Add an option to disable object <-> object collision for Lua entitiesPilzAdam2013-07-20
* Move scriptapi to separate folder (by sapier)sapier2013-05-25
an> "value", [1] = "eins", [true] = { a = "b", c = false, }, ["es:cape1"] = "foo:bar", ["es&ca\npe2"] = "baz&bam\nbim", ["es&&ca&\npe3"] = "baz&&bam&\nbim", ["es&:cape4"] = "foo\n:bar" } local testser = [[LUA_SER v=2 B1:T Sa:Sb Sc:B0 E Skey:Svalue Ses&&&&ca&&&npe3:Sbaz&&&&bam&&&nbim N1:Seins Ses&&&:cape4:Sfoo&n&:bar Ses&&ca&npe2:Sbaz&&bam&nbim Ses&:cape1:Sfoo&:bar E END_SER ]] local function check_write(tb, conf) f = mock_file:create() ser.write_to_fd(tb, f, conf or {}) return f.content end function string:split() local fields = {} self:gsub("[^\n]+", function(c) fields[#fields+1] = c end) return fields end local function check_read(text) f = mock_file:create(text:split()) return ser.read_from_fd(f) end local noskip = [[LUA_SER v=2 N1:T E E END_SER ]] local skip = [[LUA_SER v=2 E END_SER ]] describe("write_to_fd", function() it("does not skip empty tables", function() assert.equals(check_write({{}}),noskip) end) it("skips empty tables when needed", function() assert.equals(check_write({{}},{skip_empty_tables=true}),skip) end) end) describe("read_from_fd", function () it("reads a table correctly", function() assert.same(check_read(testser),testtable) end) it("handles some edge cases correctly", function() assert.same(check_read(noskip), {{}}) assert.same(check_read(skip), {}) end) it("Read back table", function() local tb = {} for k=1,262 do tb[k] = { "Foo", "bar", k} end assert.same(check_read(check_write(tb)), tb) end) end)