void CLuaFileDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classmetamethod ( luaVM, "__gc", fileCloseGC ); lua_classfunction ( luaVM, "create", "fileOpen" ); lua_classfunction ( luaVM, "destroy", "fileClose" ); lua_classfunction ( luaVM, "close", "fileClose" ); lua_classfunction ( luaVM, "new", "fileCreate" ); lua_classfunction ( luaVM, "delete", "fileDelete" ); lua_classfunction ( luaVM, "exists", "fileExists" ); lua_classfunction ( luaVM, "flush", "fileFlush" ); lua_classfunction ( luaVM, "getPos", "fileGetPos" ); lua_classfunction ( luaVM, "getSize", "fileGetSize" ); lua_classfunction ( luaVM, "isEOF", "fileIsEOF" ); lua_classfunction ( luaVM, "read", "fileRead" ); lua_classfunction ( luaVM, "rename", "fileRename" ); lua_classfunction ( luaVM, "setPos", "fileSetPos" ); lua_classfunction ( luaVM, "write", "fileWrite" ); lua_classfunction ( luaVM, "copy", "fileCopy" ); lua_classfunction ( luaVM, "getPath", "fileGetPath" ); lua_classvariable ( luaVM, "pos", "fileSetPos", "fileGetPos" ); lua_classvariable ( luaVM, "size", NULL, "fileGetSize" ); lua_classvariable ( luaVM, "isEOF", NULL, "fileIsEOF" ); lua_classvariable ( luaVM, "path", NULL, "fileGetPath" ); lua_registerclass ( luaVM, "File" ); }
void CLuaVector4Defs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classmetamethod ( luaVM, "__tostring", ToString ); lua_classmetamethod ( luaVM, "__gc", Destroy ); lua_classmetamethod ( luaVM, "__add", Add ); lua_classmetamethod ( luaVM, "__sub", Sub ); lua_classmetamethod ( luaVM, "__mul", Mul ); lua_classmetamethod ( luaVM, "__div", Div ); lua_classmetamethod ( luaVM, "__pow", Pow ); lua_classmetamethod ( luaVM, "__unm", Unm ); lua_classmetamethod ( luaVM, "__eq", Eq ); lua_classmetamethod ( luaVM, "__len", GetLength ); lua_classfunction ( luaVM, "create", "", Create ); lua_classfunction ( luaVM, "normalize", "", Normalize ); lua_classfunction ( luaVM, "dot", "", Dot ); lua_classfunction ( luaVM, "getLength", "", GetLength ); lua_classfunction ( luaVM, "getSquaredLength", "", GetLengthSquared ); lua_classfunction ( luaVM, "getNormalized", "", GetNormalized ); lua_classfunction ( luaVM, "getX", "", GetX ); lua_classfunction ( luaVM, "getY", "", GetY ); lua_classfunction ( luaVM, "getZ", "", GetZ ); lua_classfunction ( luaVM, "getW", "", GetW ); lua_classfunction ( luaVM, "setX", "", SetX ); lua_classfunction ( luaVM, "setY", "", SetY ); lua_classfunction ( luaVM, "setZ", "", SetZ ); lua_classfunction ( luaVM, "setW", "", SetW ); lua_classvariable ( luaVM, "x", "", "", SetX, GetX ); lua_classvariable ( luaVM, "y", "", "", SetY, GetY ); lua_classvariable ( luaVM, "z", "", "", SetZ, GetZ ); lua_classvariable ( luaVM, "w", "", "", SetW, GetW ); lua_classvariable ( luaVM, "length", "", "", NULL, GetLength ); lua_classvariable ( luaVM, "squaredLength", "", "", NULL, GetLengthSquared ); lua_classvariable ( luaVM, "normalized", "", "", NULL, GetNormalized ); lua_registerclass ( luaVM, "Vector4" ); }
void CLuaMatrixDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classmetamethod ( luaVM, "__tostring", ToString ); lua_classmetamethod ( luaVM, "__gc", Destroy ); lua_classmetamethod ( luaVM, "__add", Add ); lua_classmetamethod ( luaVM, "__sub", Sub ); lua_classmetamethod ( luaVM, "__mul", Mul ); lua_classmetamethod ( luaVM, "__div", Div ); lua_classfunction ( luaVM, "create", "", Create ); lua_classfunction ( luaVM, "transformPosition", "", TransformPosition ); lua_classfunction ( luaVM, "transformDirection", "", TransformDirection ); lua_classfunction ( luaVM, "inverse", "", Inverse ); lua_classfunction ( luaVM, "getPosition", "", GetPosition ); lua_classfunction ( luaVM, "getRotation", "", GetRotation ); lua_classfunction ( luaVM, "getForward", "", GetForward ); lua_classfunction ( luaVM, "getRight", "", GetRight ); lua_classfunction ( luaVM, "getUp", "", GetUp ); lua_classfunction ( luaVM, "setPosition", "", SetPosition ); lua_classfunction ( luaVM, "setRotation", "", SetRotation ); lua_classfunction ( luaVM, "setForward", "", SetForward ); lua_classfunction ( luaVM, "setRight", "", SetRight ); lua_classfunction ( luaVM, "setUp", "", SetUp ); lua_classvariable ( luaVM, "position", "", "", SetPosition, GetPosition ); lua_classvariable ( luaVM, "rotation", "", "", SetRotation, GetRotation ); lua_classvariable ( luaVM, "forward", "", "", SetForward, GetForward ); lua_classvariable ( luaVM, "right", "", "", SetRight, GetRight ); lua_classvariable ( luaVM, "up", "", "", SetUp, GetUp ); lua_registerclass ( luaVM, "Matrix" ); }