Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Hooking/getting "cdecl" functions isn't working #8

Description

@sillypears

One of the things I wanted to do was add a new staircase to the lobby. I have gone through various functions that I assume I'd be able to do this with, however upon hooking them, I am not able to get them to finish execution successfully. Below is one of the functions, the lua and the output. I'm not sure if this is an issue with the function not having any parameters, but it's looking for c_RoomData to come back and complaining that I have the wrong parameters. I've tried empty, true, and various other things to no avail.

c_RoomData *__cdecl c_Level::m_PlaceFirstRoom()

necrolua.hook("c_Level::m_PlaceFirstRoom", function(func)
    print "New z1 :)"
    local first_room = necrolua.get("c_Level::m_rooms")
    print "print rooms"
    print(first_room)
    print "func(true)"
    func(true)
    print "return true"
    return true
end)
New z1 :)
[NecroLuaAPI.dll][Lua] nl_luainit.lua:424: nl_get :: cast("c_List48*", 16734664)
print rooms
cdata<struct c_List48 *>: 0x00ff59c8
func(true)
mods\lobby\lua\init.lua:7: wrong number of arguments for function call
stack traceback:
        [C]: in function 'func'
        mods\lobby\lua\init.lua:7: in function <mods\lobby\lua\init.lua:1>
        [C]: in function 'xpcall'
        nl_luainit.lua:451: in function <nl_luainit.lua:450>
[NecroLuaAPI.dll] nl_payload.c:150: Mod API finalized.
[NecroLua.exe] nl_launcher.c: 58: Done with exit code 0x00000001

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions