Jump to content

Leadwerks 4.6: Cannot get hook to work with Map:Load()


Go to solution Solved by Josh,

Recommended Posts

Hello, I'm trying to use the hook on Map:Load() to call a Lua function every time an entity is loaded.

However, the documentation describes the hook as a "pointer to a function that will be called for each loaded entity in the scene", but I do not know how to get a pointer for a Lua function, as it seems Lua doesn't have pointers.


I do have the professional version of Leadwerks, and am familiar with C++, thus is there some interaction with C++ and Lua that I'm missing?

Link to comment
Share on other sites

  • Solution


A point to a Lua function is just the function name:

function loadhook(progress)

LoadMap("Maps/test.map", "loadhook")

In Ultra, the Lua binding system I am using provides more control, and the Lua function itself can be passed to functions.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...