noita-mapcap/files/compatibility.lua
David Vogel f58b005155 Several fixes and improvements
- Change vscode Lua runtime to LuaJIT
- Remove worm entity overrides
- Remove preparePlayer() that sets HP and other stuff
- Change how entites are captured
- Increase entity capture radius
- Capture entities as soon as possible
- Modify entites immediately after they are captured
- Make stringArgs in print local
- Fix JSON marshaling of Noita vectors
- Fix NoitaEntity:GetComponents() and NoitaEntity:GetFirstComponent()
- Add varArg support to NoitaComponent:SetValue() and NoitaComponent:ObjectSetValue()
- Update some EmmyLua annotations
- Fix custom GamePrint
- Add table.pack function that is missing in LuaJIT
2022-07-18 22:07:53 +02:00

38 lines
853 B
Lua

-- Copyright (c) 2019-2022 David Vogel
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
-- Some code to make noita's lua more conform to standard lua
-- Globally overwrite print function to behave more like expected
local oldPrint = print
function print(...)
local arg = {...}
local stringArgs = {}
for i, v in ipairs(arg) do
table.insert(stringArgs, tostring(v))
end
oldPrint(unpack(stringArgs))
end
-- Overwrite print to copy its output into a file
--[[local logFile = io.open("lualog.txt", "w")
function print(...)
local arg = {...}
local stringArgs = {}
local result = ""
for i, v in ipairs(arg) do
table.insert(stringArgs, tostring(v))
result = result .. tostring(v) .. "\t"
end
result = result .. "\n"
logFile:write(result)
logFile:flush()
oldPrint(unpack(stringArgs))
end]]