Cuberite Forum
cPlugin_NewLua: why is it Lua-exported? - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: cPlugin_NewLua: why is it Lua-exported? (/thread-465.html)

Pages: 1 2 3


cPlugin_NewLua: why is it Lua-exported? - xoft - 06-06-2012

I'm having a hard time understanding why the entire cPlugin_NewLua class is exported to Lua. Especially the callback, OnBlockDig() et al. Why would anything from Lua call these? Even worse, there doesn't seem to be a way to get the object instance on which to call the functions.

I need some serious light-shedding here.


RE: cPlugin_NewLua: why is it Lua-exported? - FakeTruth - 06-06-2012

Let me shed some light on that. It is exported to Lua, but it doesn't need to.


I HAVE SPOKEN!


RE: cPlugin_NewLua: why is it Lua-exported? - xoft - 06-06-2012

Behold the word of Truth. The word of Fake Truth Smile))


RE: cPlugin_NewLua: why is it Lua-exported? - FakeTruth - 06-06-2012

Amen to that.

Hallelujah!


RE: cPlugin_NewLua: why is it Lua-exported? - xoft - 06-10-2012

And how about cPlugin's callbacks, do those need to be exported? I wouldn't think so, but what do I know...


RE: cPlugin_NewLua: why is it Lua-exported? - FakeTruth - 06-10-2012

They need to be exported for the old plugins. It uses tolua++ to call functions from C++ to lua, therefore they need to be exported


RE: cPlugin_NewLua: why is it Lua-exported? - xoft - 06-13-2012

Are old plugins still used at all?

I'm currently experiencing issues trying to add a callback, ToLua produces uncompilable code for cPlugin binding. I'd say it's time to chuck old plugins away.


RE: cPlugin_NewLua: why is it Lua-exported? - FakeTruth - 06-14-2012

Fine. I didn't think they would interfere, but if they do I say ditch themTongue


RE: cPlugin_NewLua: why is it Lua-exported? - Taugeshtu - 06-14-2012

Still, if one really need old plugin to work - re-write it!
It's really simple (replace GetWorld() with GetDefaultWorld(), delete PluginName: prefix in hook callbacks and get rid of all setmetatable-related stuff).


RE: cPlugin_NewLua: why is it Lua-exported? - xoft - 06-14-2012

No, Taugeshtu, those are actually the new plugins already. The old plugins are ones that are set in the settings.ini by Plugin=<name>, rather than NewPlugin=<name>. They have a completely different architecture, from what I can gather. I don't even think all the new hooks work in them. I certainly didn't write any glue code for that.