Posts: 6,482
	Threads: 176
	Joined: Jan 2012
	
Thanks: 131
	Given 1085 thank(s) in 857 post(s)
	 
 
	
	
		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.
	
	
	
	
	
 
 
	
	
	
		
	Posts: 1,450
	Threads: 53
	Joined: Feb 2011
	
Thanks: 15
	Given 130 thank(s) in 99 post(s)
	 
 
	
	
		Let me shed some light on that. It is exported to Lua, but it doesn't need to.
I HAVE SPOKEN!
	
	
	
	
	
 
 
	
	
	
		
	Posts: 1,450
	Threads: 53
	Joined: Feb 2011
	
Thanks: 15
	Given 130 thank(s) in 99 post(s)
	 
 
	
	
		Amen to that. 
Hallelujah! 
	
	
	
	
	
 
 
	
	
	
		
	Posts: 6,482
	Threads: 176
	Joined: Jan 2012
	
Thanks: 131
	Given 1085 thank(s) in 857 post(s)
	 
 
	
	
		And how about cPlugin's callbacks, do those need to be exported? I wouldn't think so, but what do I know...
	
	
	
	
	
 
 
	
	
	
		
	Posts: 1,450
	Threads: 53
	Joined: Feb 2011
	
Thanks: 15
	Given 130 thank(s) in 99 post(s)
	 
 
	
	
		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
	
	
	
	
	
 
 
	
	
	
		
	Posts: 6,482
	Threads: 176
	Joined: Jan 2012
	
Thanks: 131
	Given 1085 thank(s) in 857 post(s)
	 
 
	
	
		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.
	
	
	
	
	
 
 
	
	
	
		
	Posts: 313
	Threads: 32
	Joined: Feb 2012
	
Thanks: 98
	Given 14 thank(s) in 13 post(s)
	 
 
	
	
		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).
	
	
	
	
	
 
 
	
	
	
		
	Posts: 6,482
	Threads: 176
	Joined: Jan 2012
	
Thanks: 131
	Given 1085 thank(s) in 857 post(s)
	 
 
	
	
		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.