Jump to content

  • Log In with Google      Sign In   
  • Create Account

Using XNA enum type in Lua


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 satsujin   Members   -  Reputation: 139

Like
0Likes
Like

Posted 29 November 2013 - 08:37 AM

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

 



Sponsor:

#2 satsujin   Members   -  Reputation: 139

Like
0Likes
Like

Posted 29 November 2013 - 08:51 AM

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.



#3 satsujin   Members   -  Reputation: 139

Like
0Likes
Like

Posted 29 November 2013 - 10:30 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS