Using XNA enum type in Lua

Started by
1 comment, last by satsujin 10 years, 4 months ago

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

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.

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.

This topic is closed to new replies.

Advertisement