Jump to content
  • Advertisement
Sign in to follow this  

LuaInterface: Trouble passing LuaTable

This topic is 3168 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, I'm using LuaInterface, and I have a system that allows for simple Lua-defined effects to be rendered onto the screen. Parameters are generated by a separate piece of Lua code in the form of a table. This table is passed to C#-based effect creation code as a LuaTable object, where it is used for an Effect class's Lua script. The abridge Lua script for a sample Effect is as follows:
duration = paramtable["duration"]
period = paramtable["period"]
[/source][/source] The C# Effect class is as follows:
public class Effect
   //The Lua script that will be executed.
   private string script;
   //The Lua state
   private Lua luastate;

   public Effect(LuaTable parameters)
       luastate["paramtable"] = parameters;
[/source][/source] By using the debugger, I can confirm that 'parameters' is an instantiated LuaTable, and accessing it through the Immediate Window confirms that the variables are properly mapped to their respective keys. However, I receive LuaExceptions from the Lua state which say that 'paramtable' on the Lua side is a nil value. What am I doing wrong that is causing this error? Thanks much in advance. EDIT: All other CLR classes are being sent back and forth without any trouble. Only LuaTables are messing up. [Edited by - g0dwyn on April 14, 2010 12:30:34 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!