Jump to content
  • Advertisement
Sign in to follow this  
g0dwyn

LuaInterface: Trouble passing LuaTable

This topic is 3082 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:
[SOURCE]
duration = paramtable["duration"]
period = paramtable["period"]
--...
[/SOURCE]
[/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;
       luastate.DoString(script);
   }
}
[/SOURCE]
[/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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!