Jump to content
  • Advertisement
Sign in to follow this  
satsujin

Using XNA enum type in Lua

This topic is 2154 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

I am trying to use the Keys enum type while scripting with Lua.

 

In C#, I have the following definitions:

luaVM["Keys"] = Activator.CreateInstance(typeof(Microsoft.Xna.Framework.Input.Keys));

luaVM["key"] = Keyboard.GetState();

But when compiling the lua script I get error "invalid arguments to method: KeyboardState.IsKeyDown" on the following line in my script:

if (key.IsKeyDown(Keys.Space)) then

 

Share this post


Link to post
Share on other sites
Advertisement

if I change that to key:IsKeyDown the error doesnt happen but the if block still doesnt get executed which means there must still be some misrepresentation of the enumtype.

Share this post


Link to post
Share on other sites

Okay here's the weird thing....

 

The if block IS executing but only if I hold down the Space key for a while. It's like there is some lag in the program or something. Anyone know whats happening here? This script is being executed in the XNA Update loop.

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!