I'm using an version of Lua 5.1 in a game called Kingdoms of Amalur. This is havocscript but afaik, havocscript is lua. Now there is a custom type called ui64
that the game has and a custom package that injects a hook that I added to the game.
If I do the following:
module("playerdodge_hook", package.seeall)
function save_to_file(filename, data)
if io then
io.output(filename)
io.write(data)
io.flush()
end
end
function dodge_hook()
local x = SIMTYPE_ID("longbow_unique11a")
save_to_file("type", type(x))
save_to_file("directly", x)
save_to_file("tostring", tostring(x))
save_to_file("concat", "" .. x)
end
The output of the files are the following: type
ui64
Directly
Sin
tostring
0
concat (does not exist)
I am no expert in Lua, but i'm trying to understand how this works. As I would like to be able to print debug information and save this externally.
Edit: Short answer is the game's engine used a proprietary override the io write method.
Amalur has different types, and the ui64
is actually a pointer to some memory inaccessible to lua/havok script, but the library allows manipulation. And basically when a ui64
is passed in raw to write
calls the localization for the Type
or Actor
or whatever the internal object represented.
had an altered version of io library that when it received an ui64 would interrogate the