[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Table Reference Calls / Functions
- From: Saiyuk <saiyuk7@...>
- Date: Sun, 15 May 2011 17:53:49 +0000 (UTC)
Hi, is it possible to create tables with functions inside them and use the table
as reference calls as you can do inside C++? example...
class TestClass {
public
.....
.....
TestClass& GetObject()
{
return *this;
}
int TestInteger()
{
return 55;
}
};
if(myclass.GetObject().TestInteger() == 55)
{
statement block
}
Lua example:
Keys = {
ALT = 18,
A = 65,
B = 66,
C = 67
}
--[[
Keyboard is the registered library
GetState(vk_code) vk_code is the virtual keycode, inside the table Keys
IsMod(vk_code) modifier key, checks to see if modifier key is applied
--]]
function test()
if(Keyboard.GetState(Keys.A).IsMod(Keys.ALT))
print("A & ALT are down\n");
else
print("... implement here\n");
end
test()