Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Using XNA enum type in Lua

4: Adsense

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   

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

 



#2 satsujin   Members   

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   

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.