void CLuaDatabaseDefs::AddClass ( lua_State* luaVM ) { ////////////////////////// // Connection class ////////////////////////// lua_newclass ( luaVM ); lua_classfunction ( luaVM, "create", "dbConnect" ); lua_classfunction ( luaVM, "exec", "dbExec" ); lua_classfunction ( luaVM, "prepareString", "dbPrepareString" ); lua_classfunction ( luaVM, "query", "dbQuery", OOP_DbQuery ); lua_registerclass ( luaVM, "Connection", "Element" ); ////////////////////////// ////////////////////////// // QueryHandle class ////////////////////////// lua_newclass ( luaVM ); lua_classfunction ( luaVM, "poll", "dbPoll" ); lua_classfunction ( luaVM, "free", "dbFree" ); lua_registerclass ( luaVM, "QueryHandle", NULL, false ); ////////////////////////// }
void CLuaACLDefs::AddClasses ( lua_State* luaVM ) { ////////////////////////// // ACL class ////////////////////////// lua_newclass ( luaVM ); lua_classfunction ( luaVM, "save", "aclSave" ); lua_classfunction ( luaVM, "get", "aclGet" ); lua_classfunction ( luaVM, "reload", "aclReload" ); lua_classfunction ( luaVM, "list", "aclList" ); lua_classfunction ( luaVM, "hasObjectPermissionTo", "hasObjectPermissionTo" ); lua_classfunction ( luaVM, "create", "aclCreate" ); lua_classfunction ( luaVM, "destroy", "aclDestroy" ); lua_classfunction ( luaVM, "listRights", "aclListRights" ); lua_classfunction ( luaVM, "removeRight", "aclRemoveRight" ); lua_classfunction ( luaVM, "getName", "aclGetName" ); lua_classfunction ( luaVM, "getRight", "aclGetRight" ); lua_classfunction ( luaVM, "setRight", "aclSetRight" ); lua_classvariable ( luaVM, "name", NULL, "aclGetName" ); //lua_classvariable ( luaVM, "rights", "", "aclListRights", NULL, CLuaOOPDefs::AclListRights ); // .rights[allowedType] = {..} //lua_classvariable ( luaVM, "right", "aclSetRight", "aclGetRight", CLuaOOPDefs::AclSetRight, CLuaOOPDefs::AclGetRight ); // .right["e.y.e"] = "illuminati"; if value == nil then aclRemoveRight(self, key) lua_registerclass ( luaVM, "ACL" ); ////////////////////////// ////////////////////////// // ACLGroup class ////////////////////////// lua_newclass ( luaVM ); lua_classfunction ( luaVM, "get", "aclGetGroup" ); lua_classfunction ( luaVM, "list", "aclGroupList" ); lua_classfunction ( luaVM, "create", "aclCreateGroup" ); lua_classfunction ( luaVM, "destroy", "aclDestroyGroup" ); lua_classfunction ( luaVM, "doesContainObject", "isObjectInACLGroup", OOP_isObjectInACLGroup ); lua_classfunction ( luaVM, "addACL", "aclGroupAddACL" ); lua_classfunction ( luaVM, "addObject", "aclGroupAddObject" ); lua_classfunction ( luaVM, "removeACL", "aclGroupRemoveACL" ); lua_classfunction ( luaVM, "removeObject", "aclGroupRemoveObject" ); lua_classfunction ( luaVM, "listACL", "aclGroupListACL" ); lua_classfunction ( luaVM, "listObjects", "aclGroupListObjects" ); lua_classfunction ( luaVM, "getName", "aclGroupGetName" ); lua_classvariable ( luaVM, "name", NULL, "aclGroupGetName" ); lua_classvariable ( luaVM, "aclList", NULL, "aclGroupListACL" ); // value nil = remove acl lua_classvariable ( luaVM, "objects", NULL, "aclGroupListObjects" ); // value nil = remove object lua_registerclass ( luaVM, "ACLGroup" ); }
void CLuaTextDefs::AddClasses ( lua_State* luaVM ) { ////////////////////////// // TextDisplay class ////////////////////////// lua_newclass ( luaVM ); lua_classfunction ( luaVM, "create", "textCreateDisplay" ); lua_classfunction ( luaVM, "destroy", "textDestroyDisplay" ); lua_classfunction ( luaVM, "addObserver", "textDisplayAddObserver" ); lua_classfunction ( luaVM, "removeObserver", "textDisplayRemoveObserver" ); lua_classfunction ( luaVM, "addText", "textDisplayAddText" ); lua_classfunction ( luaVM, "removeText", "textDisplayRemoveText" ); lua_classfunction ( luaVM, "isObserver", "textDisplayIsObserver" ); lua_classfunction ( luaVM, "getObservers", "textDisplayGetObservers" ); lua_classvariable ( luaVM, "observers", NULL, "textDisplayGetObservers" ); lua_registerclass ( luaVM, "TextDisplay" ); ////////////////////////// ////////////////////////// // TextItem class ////////////////////////// lua_newclass ( luaVM ); lua_classfunction ( luaVM, "create", "textCreateTextItem" ); lua_classfunction ( luaVM, "destroy", "textDestroyTextItem" ); lua_classfunction ( luaVM, "getColor", "textItemGetColor" ); lua_classfunction ( luaVM, "getPosition", "textItemGetPosition" ); lua_classfunction ( luaVM, "getPriority", "textItemGetPriority" ); lua_classfunction ( luaVM, "getScale", "textItemGetScale" ); lua_classfunction ( luaVM, "getText", "textItemGetText" ); lua_classfunction ( luaVM, "setColor", "textItemSetColor" ); lua_classfunction ( luaVM, "setPosition", "textItemSetPosition" ); lua_classfunction ( luaVM, "setPriority", "textItemSetPriority" ); lua_classfunction ( luaVM, "setScale", "textItemSetScale" ); lua_classfunction ( luaVM, "setText", "textItemSetText" ); lua_classvariable ( luaVM, "priority", "textItemSetPriority", "textItemGetPriority" ); lua_classvariable ( luaVM, "scale", "textItemSetScale", "textItemGetScale" ); lua_classvariable ( luaVM, "text", "textItemSetText", "textItemGetText" ); //lua_classvariable ( luaVM, "color", "textItemSetColor", "textItemGetColor", CLuaOOPDefs::TextItemSetColor, CLuaOOPDefs::TextItemGetColor ); // color lua_classvariable ( luaVM, "position", "textItemSetPosition", "textItemGetPosition" ); lua_registerclass ( luaVM, "TextItem" ); ////////////////////////// }
void CLuaEngineDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classfunction ( luaVM, "restoreCOL", "engineRestoreCOL" ); lua_classfunction ( luaVM, "restoreModel", "engineRestoreModel" ); lua_classfunction ( luaVM, "setAsynchronousLoading", "engineSetAsynchronousLoading" ); lua_classfunction ( luaVM, "setModelLODDistance", "engineSetModelLODDistance" ); lua_classfunction ( luaVM, "getVisibleTextureNames", "engineGetVisibleTextureNames" ); lua_classfunction ( luaVM, "getModelLODDistance", "engineGetModelLODDistance" ); lua_classfunction ( luaVM, "getModelTextureNames", "engineGetModelTextureNames" ); lua_classfunction ( luaVM, "getModelIDFromName", "engineGetModelIDFromName" ); lua_classfunction ( luaVM, "getModelNameFromID", "engineGetModelNameFromID" ); // lua_classvariable ( luaVM, "modelLODDistance", "engineSetModelLODDistance", "engineGetModelLODDistance" ); .modelLODDistance[model] = distance // lua_classvariable ( luaVM, "modelNameFromID", NULL, "engineGetModelNameFromID" ); .modelNameFromID[id] = "name" // lua_classvariable ( luaVM, "modelIDFromName", NULL, "engineGetModelIDFromName" ); .modelIDFromName["name"] = id // lua_classvariable ( luaVM, "modelTextureNames", NULL, "engineGetModelTextureNames" ); .modelTextureNames[mode] = {names} lua_registerstaticclass ( luaVM, "Engine" ); AddEngineColClass ( luaVM ); AddEngineTxdClass ( luaVM ); AddEngineDffClass ( luaVM ); }
static inline int _trefget( lua_State *L, LuaRoot *root ) { lua_pushlightuserdata( L, root ); lua_pushcclosure( L, luaconstructor_root, 1 ); lua_newclass( L ); return luaL_ref( L, LUA_REGISTRYINDEX ); }
void CLuaBlipDefs::AddClass(lua_State* luaVM) { lua_newclass(luaVM); lua_classfunction(luaVM, "create", "createBlip"); lua_classfunction(luaVM, "createAttachedTo", "createBlipAttachedTo"); lua_classfunction(luaVM, "getColor", "getBlipColor"); lua_classfunction(luaVM, "getVisibleDistance", "getBlipVisibleDistance"); lua_classfunction(luaVM, "getOrdering", "getBlipOrdering"); lua_classfunction(luaVM, "getSize", "getBlipSize"); lua_classfunction(luaVM, "getIcon", "getBlipIcon"); lua_classfunction(luaVM, "setColor", "setBlipColor"); lua_classfunction(luaVM, "setVisibleDistance", "setBlipVisibleDistance"); lua_classfunction(luaVM, "setOrdering", "setBlipOrdering"); lua_classfunction(luaVM, "setSize", "setBlipSize"); lua_classfunction(luaVM, "setIcon", "setBlipIcon"); lua_classvariable(luaVM, "icon", "setBlipIcon", "getBlipIcon"); lua_classvariable(luaVM, "size", "setBlipSize", "getBlipSize"); lua_classvariable(luaVM, "ordering", "setBlipOrdering", "getBlipOrdering"); lua_classvariable(luaVM, "visibleDistance", "setBlipVisibleDistance", "getBlipVisibleDistance"); // lua_classvariable ( luaVM, "color", "setBlipColor", "getBlipColor" ); lua_registerclass(luaVM, "Blip", "Element"); }
void CLuaBanDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classfunction ( luaVM, "create", "addBan" ); lua_classfunction ( luaVM, "getList", "getBans" ); lua_classfunction ( luaVM, "reload", "reloadBans" ); lua_classfunction ( luaVM, "remove", "removeBan" ); lua_classfunction ( luaVM, "getAdmin", "getBanAdmin" ); lua_classfunction ( luaVM, "getIP", "getBanIP" ); lua_classfunction ( luaVM, "getNick", "getBanNick" ); lua_classfunction ( luaVM, "getReason", "getBanReason" ); lua_classfunction ( luaVM, "getSerial", "getBanSerial" ); lua_classfunction ( luaVM, "getTime", "getBanTime" ); lua_classfunction ( luaVM, "getUnbanTime", "getUnbanTime" ); lua_classfunction ( luaVM, "setUnbanTime", "setUnbanTime" ); lua_classfunction ( luaVM, "setReason", "setBanReason" ); lua_classfunction ( luaVM, "setNick", "setBanNick" ); lua_classfunction ( luaVM, "setAdmin", "setBanAdmin" ); lua_classvariable ( luaVM, "admin", "setBanAdmin", "getBanAdmin" ); lua_classvariable ( luaVM, "IP", NULL, "getBanIP" ); lua_classvariable ( luaVM, "serial", NULL, "getBanSerial" ); lua_classvariable ( luaVM, "time", NULL, "getBanTime" ); lua_classvariable ( luaVM, "unbanTime", "setUnbanTime", "getUnbanTime" ); lua_classvariable ( luaVM, "reason", "setBanReason", "getBanReason" ); lua_classvariable ( luaVM, "nick", "setBanNick", "getBanNick" ); lua_registerclass ( luaVM, "Ban" ); }
void CLuaXMLDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classfunction ( luaVM, "load", "xmlLoadFile" ); lua_classfunction ( luaVM, "unload", "xmlUnloadFile" ); lua_classfunction ( luaVM, "copy", "xmlCopyFile" ); lua_classfunction ( luaVM, "create", "xmlCreateFile" ); lua_classfunction ( luaVM, "destroy", "xmlDestroyNode" ); lua_classfunction ( luaVM, "loadMapData", "loadMapData" ); lua_classfunction ( luaVM, "saveMapData", "saveMapData" ); lua_classfunction ( luaVM, "getValue", "xmlNodeGetValue" ); lua_classfunction ( luaVM, "setAttribute", "xmlNodeSetAttribute" ); lua_classfunction ( luaVM, "setValue", "xmlNodeSetValue" ); lua_classfunction ( luaVM, "saveFile", "xmlSaveFile" ); lua_classfunction ( luaVM, "createChild", "xmlCreateChild" ); lua_classfunction ( luaVM, "findChild", "xmlFindChild" ); lua_classfunction ( luaVM, "setName", "xmlNodeSetName" ); lua_classfunction ( luaVM, "getAttributes", "xmlNodeGetAttributes" ); lua_classfunction ( luaVM, "getChildren", "xmlNodeGetChildren" ); lua_classfunction ( luaVM, "getName", "xmlNodeGetName" ); lua_classfunction ( luaVM, "getParent", "xmlNodeGetParent" ); lua_classfunction ( luaVM, "getAttribute", "xmlNodeGetAttribute" ); lua_classvariable ( luaVM, "value", "xmlNodeSetValue", "xmlNodeGetValue" ); lua_classvariable ( luaVM, "name", "xmlNodeSetName", "xmlNodeGetName" ); lua_classvariable ( luaVM, "attributes", NULL, "xmlNodeGetAttributes" ); lua_classvariable ( luaVM, "children", NULL, "xmlNodeGetChildren" ); lua_classvariable ( luaVM, "parent", NULL, "xmlNodeGetParent" ); lua_registerclass ( luaVM, "XML" ); }
void CLuaFileDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); 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_classvariable ( luaVM, "pos", "fileSetPos", "fileGetPos" ); lua_classvariable ( luaVM, "size", NULL, "fileGetSize" ); lua_classvariable ( luaVM, "isEOF", NULL, "fileIsEOF" ); lua_registerclass ( luaVM, "File" ); }
void CLuaMarkerDefs::AddClass(lua_State* luaVM) { lua_newclass(luaVM); lua_classfunction(luaVM, "create", "createMarker"); lua_classfunction(luaVM, "getCount", "getMarkerCount"); lua_classfunction(luaVM, "getMarkerType", "getMarkerType"); lua_classfunction(luaVM, "getIcon", "getMarkerIcon"); lua_classfunction(luaVM, "getSize", "getMarkerSize"); lua_classfunction(luaVM, "getTarget", "getMarkerTarget", OOP_GetMarkerTarget); lua_classfunction(luaVM, "getColor", "getMarkerColor"); // color lua_classfunction(luaVM, "setType", "setMarkerType"); lua_classfunction(luaVM, "setIcon", "setMarkerIcon"); lua_classfunction(luaVM, "setSize", "setMarkerSize"); lua_classfunction(luaVM, "setTarget", "setMarkerTarget"); lua_classfunction(luaVM, "setColor", "setMarkerColor"); // color lua_classvariable(luaVM, "markerType", "setMarkerType", "getMarkerType"); lua_classvariable(luaVM, "icon", "setMarkerIcon", "getMarkerIcon"); lua_classvariable(luaVM, "size", "setMarkerSize", "getMarkerSize"); lua_classvariable(luaVM, "target", "setMarkerTarget", "getMarkerTarget", SetMarkerTarget, OOP_GetMarkerTarget); // lua_classvariable ( luaVM, "color", CLuaOOPDefs::SetMarkerColor, CLuaOOPDefs::GetMarkerColor ); color lua_registerclass(luaVM, "Marker", "Element"); }
void CLuaEffectDefs::AddClass(lua_State* luaVM) { lua_newclass(luaVM); lua_classfunction(luaVM, "create", "createEffect"); lua_classfunction(luaVM, "addBlood", "fxAddBlood"); lua_classfunction(luaVM, "addBulletImpact", "fxAddBulletImpact"); lua_classfunction(luaVM, "addBulletSplash", "fxAddBulletSplash"); lua_classfunction(luaVM, "addDebris", "fxAddDebris"); lua_classfunction(luaVM, "addFootSplash", "fxAddFootSplash"); lua_classfunction(luaVM, "addGlass", "fxAddGlass"); lua_classfunction(luaVM, "addGunshot", "fxAddGunshot"); lua_classfunction(luaVM, "addPunchImpact", "fxAddPunchImpact"); lua_classfunction(luaVM, "addSparks", "fxAddSparks"); lua_classfunction(luaVM, "addTankFire", "fxAddTankFire"); lua_classfunction(luaVM, "addTyreBurst", "fxAddTyreBurst"); lua_classfunction(luaVM, "addWaterHydrant", "fxAddWaterHydrant"); lua_classfunction(luaVM, "addWaterSplash", "fxAddWaterSplash"); lua_classfunction(luaVM, "addWood", "fxAddWood"); lua_classfunction(luaVM, "setDensity", "setEffectDensity"); lua_classfunction(luaVM, "setSpeed", "setEffectSpeed"); lua_classfunction(luaVM, "getDensity", "getEffectDensity"); lua_classfunction(luaVM, "getSpeed", "getEffectSpeed"); lua_classvariable(luaVM, "density", "setEffectDensity", "getEffectDensity"); lua_classvariable(luaVM, "speed", "setEffectSpeed", "getEffectSpeed"); lua_registerclass(luaVM, "Effect", "Element"); }
void CLuaEngineDefs::AddEngineColClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classfunction ( luaVM, "create", "engineLoadCOL" ); lua_classfunction ( luaVM, "replace", "engineReplaceCOL" ); lua_registerclass ( luaVM, "EngineCOL", "Element" ); }
void CLuaEngineDefs::AddEngineDffClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classfunction ( luaVM, "create", "engineLoadDFF" ); lua_classfunction ( luaVM, "replace", "engineReplaceModel" ); lua_registerclass ( luaVM, "EngineDFF", "Element" ); }
void CLuaEngineDefs::AddEngineTxdClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classfunction ( luaVM, "create", "engineLoadTXD" ); lua_classfunction ( luaVM, "import", "engineImportTXD" ); lua_registerclass ( luaVM, "EngineTXD", "Element" ); }
void CLuaPlayerDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); // localPlayer only lua_classfunction ( luaVM, "giveMoney", "givePlayerMoney" ); lua_classfunction ( luaVM, "takeMoney", "takePlayerMoney" ); lua_classfunction ( luaVM, "showHudComponent", "showPlayerHudComponent" ); lua_classfunction ( luaVM, "setMoney", "setPlayerMoney" ); lua_classfunction ( luaVM, "getMoney", "getPlayerMoney" ); lua_classfunction ( luaVM, "getSerial", "getPlayerSerial" ); lua_classfunction ( luaVM, "getWantedLevel", "getPlayerWantedLevel" ); lua_classfunction ( luaVM, "getMapBoundingBox", "getPlayerMapBoundingBox" ); lua_classfunction ( luaVM, "forceMap", "forcePlayerMap" ); lua_classfunction ( luaVM, "isMapForced", "isPlayerMapForced" ); lua_classfunction ( luaVM, "isMapVisible", "isPlayerMapVisible" ); lua_classfunction ( luaVM, "isHudComponentVisible", "isPlayerHudComponentVisible" ); lua_classfunction ( luaVM, "toggleControl", "toggleControl" ); lua_classfunction ( luaVM, "create", "getPlayerFromName" ); lua_classfunction ( luaVM, "setNametagText", "setPlayerNametagText" ); lua_classfunction ( luaVM, "setNametagShowing", "setPlayerNametagShowing" ); lua_classfunction ( luaVM, "setNametagColor", "setPlayerNametagColor" ); lua_classfunction ( luaVM, "getPing", "getPlayerPing" ); lua_classfunction ( luaVM, "getName", "getPlayerName" ); lua_classfunction ( luaVM, "getTeam", "getPlayerTeam" ); lua_classfunction ( luaVM, "getNametagText", "getPlayerNametagText" ); lua_classfunction ( luaVM, "getNametagColor", "getPlayerNametagColor" ); lua_classfunction ( luaVM, "isNametagShowing", "isPlayerNametagShowing" ); lua_classvariable ( luaVM, "ping", NULL, "getPlayerPing" ); lua_classvariable ( luaVM, "name", NULL, "getPlayerName" ); lua_classvariable ( luaVM, "team", NULL, "getPlayerTeam" ); lua_classvariable ( luaVM, "nametagText", "setPlayerNametagText", "getPlayerNametagText" ); lua_classvariable ( luaVM, "nametagShowing", "setPlayerNametagShowing", "isPlayerNametagShowing" ); // Static class variables or local only variable /* lua_classvariable ( luaVM, "blurLevel", "setPlayerBlurLevel", "getPlayerBlurLevel" ); lua_classvariable ( luaVM, "mapForced", NULL, "isPlayerMapForced" ); lua_classvariable ( luaVM, "mapVisible", NULL, "isPlayerMapVisible" ); lua_classvariable ( luaVM, "money", "setPlayerMoney", "getPlayerMoney" ); lua_classvariable ( luaVM, "serial", NULL, "getPlayerSerial" ); lua_classvariable ( luaVM, "wantedLevel", NULL, "getPlayerWantedLevel" );*/ lua_registerclass ( luaVM, "Player", "Ped" ); }
int luaopen_choicehandleapi (lua_State* l) { lua_newclass(l, "choicehandle"); lregt(l, "add", ch_additem); lregt(l, "remove", ch_deleteitem); lregt(l, "clear", ch_clear); lregt(l, "find", ch_find); lregt(l, "focus", luacommonhandle_setfocus); lregt(l, "close", luacommonhandle_close); lregt(l, "__len", ch_getlen); lregt(l, "__index", ch_index); lregt(l, "__newindex", ch_newindex); lua_pop(l,1); return 0; }
void CLuaColShapeDefs::AddClass(lua_State* luaVM) { lua_newclass(luaVM); lua_classfunction(luaVM, "Circle", "createColCircle"); lua_classfunction(luaVM, "Cuboid", "createColCuboid"); lua_classfunction(luaVM, "Rectangle", "createColRectangle"); lua_classfunction(luaVM, "Sphere", "createColSphere"); lua_classfunction(luaVM, "Tube", "createColTube"); lua_classfunction(luaVM, "Polygon", "createColPolygon"); lua_classfunction(luaVM, "getElementsWithin", "getElementsWithinColShape"); lua_registerclass(luaVM, "ColShape", "Element"); }
int luaopen_menuapi (lua_State* l) { lua_newclass(l, "menuhandle"); lregt(l, "add", mh_additem); lregt(l, "addSubMenu", mh_addsubitem); lregt(l, "remove", mh_deleteitem); lregt(l, "createPopupMenu", mh_createpopup); lregt(l, "show", mh_showpopup); lregt(l, "free", mh_gc); lregt(l, "__len", mh_length); lregt(l, "__index", mh_index); lregt(l, "__newindex", mh_newindex); lregt(l, "__gc", mh_gc); lua_pop(l,1); return 0; }
void CLuaTimerDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classfunction ( luaVM, "create", "setTimer" ); lua_classfunction ( luaVM, "destroy", "killTimer" ); lua_classfunction ( luaVM, "reset", "resetTimer" ); lua_classfunction ( luaVM, "isValid", "isTimer" ); lua_classfunction ( luaVM, "getDetails", "getTimerDetails" ); lua_classvariable ( luaVM, "valid", NULL, "isTimer" ); lua_registerclass ( luaVM, "Timer" ); }
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 CLuaRadarAreaDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classfunction ( luaVM, "create", "createRadarArea" ); lua_classfunction ( luaVM, "isInside", "isInsideRadarArea" ); lua_classfunction ( luaVM, "isFlashing", "isRadarAreaFlashing" ); lua_classfunction ( luaVM, "getSize", "getRadarAreaSize" ); lua_classfunction ( luaVM, "getColor", "getRadarAreaColor" ); lua_classfunction ( luaVM, "setSize", "setRadarAreaSize" ); lua_classfunction ( luaVM, "setFlashing", "setRadarAreaFlashing" ); lua_classfunction ( luaVM, "setColor", "setRadarAreaColor" ); lua_classvariable ( luaVM, "flashing", "setRadarAreaFlashing", "isRadarAreaFlashing" ); //lua_classvariable ( luaVM, "color", "setRadarAreaColor", "getRadarAreaColor" ); lua_classvariable ( luaVM, "size", SetRadarAreaSize, OOP_GetRadarAreaSize ); lua_registerclass ( luaVM, "RadarArea", "Element" ); }
void CLuaSearchLightDefs::AddClass(lua_State* luaVM) { lua_newclass(luaVM); lua_classfunction(luaVM, "create", "createSearchLight"); lua_classfunction(luaVM, "getStartPosition", OOP_GetSearchLightStartPosition); lua_classfunction(luaVM, "getEndPosition", OOP_GetSearchLightEndPosition); lua_classfunction(luaVM, "getStartRadius", "getSearchLightStartRadius"); lua_classfunction(luaVM, "getEndRadius", "getSearchLightEndRadius"); lua_classfunction(luaVM, "setStartPosition", "setSearchLightStartPosition"); lua_classfunction(luaVM, "setEndPosition", "setSearchLightEndPosition"); lua_classfunction(luaVM, "setStartRadius", "setSearchLightStartRadius"); lua_classfunction(luaVM, "setEndRadius", "setSearchLightEndRadius"); lua_classvariable(luaVM, "startPosition", SetSearchLightStartPosition, OOP_GetSearchLightStartPosition); lua_classvariable(luaVM, "endPosition", SetSearchLightEndPosition, OOP_GetSearchLightEndPosition); lua_classvariable(luaVM, "startRadius", "setSearchLightStartRadius", "getSearchLightStartRadius"); lua_classvariable(luaVM, "endRadius", "setSearchLightEndRadius", "getSearchLightEndRadius"); lua_registerclass(luaVM, "SearchLight", "Element"); }
void CLuaAccountDefs::AddClass(lua_State* luaVM) { lua_newclass(luaVM); lua_classfunction(luaVM, "getAll", "getAccounts"); lua_classfunction(luaVM, "getAllByData", "getAccountsByData"); lua_classfunction(luaVM, "getAllBySerial", "getAccountsBySerial"); lua_classfunction(luaVM, "getAllByIP", "getAccountsByIP"); lua_classfunction(luaVM, "getFromPlayer", "getPlayerAccount"); lua_classfunction(luaVM, "logPlayerOut", "logOut"); lua_classfunction(luaVM, "create", "getAccount"); lua_classfunction(luaVM, "add", "addAccount"); lua_classfunction(luaVM, "copyDataFrom", "copyAccountData"); lua_classfunction(luaVM, "remove", "removeAccount"); lua_classfunction(luaVM, "setData", "setAccountData"); lua_classfunction(luaVM, "setPassword", "setAccountPassword"); lua_classfunction(luaVM, "setName", "setAccountName"); lua_classfunction(luaVM, "getSerial", "getAccountSerial"); lua_classfunction(luaVM, "getIP", "getAccountIP"); lua_classfunction(luaVM, "getID", "getAccountID"); lua_classfunction(luaVM, "getData", "getAccountData"); lua_classfunction(luaVM, "getAllData", "getAllAccountData"); lua_classfunction(luaVM, "getName", "getAccountName"); lua_classfunction(luaVM, "getPlayer", "getAccountPlayer"); lua_classfunction(luaVM, "isGuest", "isGuestAccount"); lua_classvariable(luaVM, "serial", NULL, "getAccountSerial"); lua_classvariable(luaVM, "name", "setAccountName", "getAccountName"); lua_classvariable(luaVM, "id", NULL, "getAccountID"); lua_classvariable(luaVM, "ip", NULL, "getAccountIP"); lua_classvariable(luaVM, "player", NULL, "getAccountPlayer"); lua_classvariable(luaVM, "guest", NULL, "isGuestAccount"); lua_classvariable(luaVM, "password", "setAccountPassword", NULL); lua_classvariable(luaVM, "data", NULL, "getAllAccountData"); // allow setting lua_registerclass(luaVM, "Account"); }
void CLuaPointLightDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classfunction ( luaVM, "create", "createLight" ); lua_classfunction ( luaVM, "getType", "getLightType" ); lua_classfunction ( luaVM, "getRadius", "getLightRadius" ); lua_classfunction ( luaVM, "getColor", "getLightColor" ); lua_classfunction ( luaVM, "getDirection", "getLightDirection" ); lua_classfunction ( luaVM, "setRadius", "setLightRadius" ); lua_classfunction ( luaVM, "setColor", "setLightColor" ); lua_classfunction ( luaVM, "setDirection", "setLightDirection" ); lua_classvariable ( luaVM, "type", nullptr, "getLightType" ); lua_classvariable ( luaVM, "radius", "setLightRadius", "getLightRadius" ); //lua_classvariable ( luaVM, "color", "setLightColor", "getLightColor" ); lua_classvariable ( luaVM, "direction", "setLightDirection", "getLightDirection" ); lua_registerclass ( luaVM, "Light", "Element" ); }
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" ); }
void CLuaMain::InitClasses ( lua_State* luaVM ) { lua_initclasses ( luaVM ); lua_newclass ( luaVM ); // Vector and Matrix classes CLuaVector4Defs ::AddClass ( luaVM ); CLuaVector3Defs ::AddClass ( luaVM ); CLuaVector2Defs ::AddClass ( luaVM ); CLuaMatrixDefs ::AddClass ( luaVM ); // OOP based classes if ( !m_bEnableOOP ) return; CLuaElementDefs ::AddClass ( luaVM ); // keep this at the top because inheritance CLuaAccountDefs ::AddClass ( luaVM ); CLuaACLDefs ::AddClass ( luaVM ); CLuaBanDefs ::AddClass ( luaVM ); CLuaBlipDefs ::AddClass ( luaVM ); CLuaColShapeDefs ::AddClass ( luaVM ); CLuaDatabaseDefs ::AddClass ( luaVM ); CLuaFileDefs ::AddClass ( luaVM ); CLuaMarkerDefs ::AddClass ( luaVM ); CLuaObjectDefs ::AddClass ( luaVM ); CLuaPedDefs ::AddClass ( luaVM ); CLuaPickupDefs ::AddClass ( luaVM ); CLuaPlayerDefs ::AddClass ( luaVM ); CLuaRadarAreaDefs ::AddClass ( luaVM ); CLuaResourceDefs ::AddClass ( luaVM ); CLuaTeamDefs ::AddClass ( luaVM ); CLuaTextDefs ::AddClass ( luaVM ); CLuaTimerDefs ::AddClass ( luaVM ); CLuaVehicleDefs ::AddClass ( luaVM ); CLuaWaterDefs ::AddClass ( luaVM ); CLuaXMLDefs ::AddClass ( luaVM ); }
// TODO: specials void CLuaPedDefs::AddClass ( lua_State* luaVM ) { lua_newclass ( luaVM ); lua_classfunction ( luaVM, "getValidModels", "getValidPedModels" ); lua_classfunction ( luaVM, "create", "createPed" ); lua_classfunction ( luaVM, "kill", "killPed" ); lua_classfunction ( luaVM, "warpIntoVehicle", "warpPedIntoVehicle" ); lua_classfunction ( luaVM, "addClothes", "addPedClothes" ); lua_classfunction ( luaVM, "giveJetPack", "givePedJetPack" ); lua_classfunction ( luaVM, "giveWeapon", "giveWeapon" ); lua_classfunction ( luaVM, "takeWeapon", "takeWeapon" ); lua_classfunction ( luaVM, "takeAllWeapons", "takeAllWeapons" ); lua_classfunction ( luaVM, "reloadWeapon", "reloadPedWeapon" ); lua_classfunction ( luaVM, "removeClothes", "removePedClothes" ); lua_classfunction ( luaVM, "removeFromVehicle", "removePedFromVehicle" ); lua_classfunction ( luaVM, "removeJetPack", "removePedJetPack" ); lua_classfunction ( luaVM, "doesHaveJetpack", "doesPedHaveJetPack" ); lua_classfunction ( luaVM, "isDead", "isPedDead" ); lua_classfunction ( luaVM, "isDucked", "isPedDucked" ); lua_classfunction ( luaVM, "isInWater", "isPedInWater" ); lua_classfunction ( luaVM, "isOnGround", "isPedOnGround" ); lua_classfunction ( luaVM, "isInVehicle", "isPedInVehicle" ); lua_classfunction ( luaVM, "isOnFire", "isPedOnFire" ); lua_classfunction ( luaVM, "isChoking", "isPedChoking" ); lua_classfunction ( luaVM, "isDoingGangDriveby", "isPedDoingGangDriveby" ); lua_classfunction ( luaVM, "isFrozen", "isPedFrozen" ); lua_classfunction ( luaVM, "isHeadless", "isPedHeadless" ); lua_classfunction ( luaVM, "getArmor", "getPedArmor" ); lua_classfunction ( luaVM, "getAnalogControlState", "getPedAnalogControlState" ); lua_classfunction ( luaVM, "getFightingStyle", "getPedFightingStyle" ); lua_classfunction ( luaVM, "getGravity", "getPedGravity" ); lua_classfunction ( luaVM, "getStat", "getPedStat" ); lua_classfunction ( luaVM, "getWeaponSlot", "getPedWeaponSlot" ); lua_classfunction ( luaVM, "getWalkingStyle", "getPedWalkingStyle" ); lua_classfunction ( luaVM, "getAmmoInClip", "getPedAmmoInClip" ); lua_classfunction ( luaVM, "getOccupiedVehicle", "getPedOccupiedVehicle" ); lua_classfunction ( luaVM, "getWeapon", "getPedWeapon" ); lua_classfunction ( luaVM, "getTarget", "getPedTarget" ); lua_classfunction ( luaVM, "getOccupiedVehicleSeat", "getPedOccupiedVehicleSeat" ); lua_classfunction ( luaVM, "getClothes", "getPedClothes" ); lua_classfunction ( luaVM, "getContactElement", "getPedContactElement" ); lua_classfunction ( luaVM, "getTotalAmmo", "getPedTotalAmmo" ); lua_classfunction ( luaVM, "setOnFire", "setPedOnFire" ); lua_classfunction ( luaVM, "setChoking", "setPedChoking" ); lua_classfunction ( luaVM, "setDoingGangDriveBy", "setPedDoingGangDriveby" ); lua_classfunction ( luaVM, "setFrozen", "setPedFrozen" ); lua_classfunction ( luaVM, "setHeadless", "setPedHeadless" ); lua_classfunction ( luaVM, "setArmor", "setPedArmor" ); lua_classfunction ( luaVM, "setAnalogControlState", "setPedAnalogControlState" ); lua_classfunction ( luaVM, "setFightingStyle", "setPedFightingStyle" ); lua_classfunction ( luaVM, "setGravity", "setPedGravity" ); lua_classfunction ( luaVM, "setStat", "setPedStat" ); lua_classfunction ( luaVM, "setWeaponSlot", "setPedWeaponSlot" ); lua_classfunction ( luaVM, "setWalkingStyle", "setPedWalkingStyle" ); lua_classfunction ( luaVM, "setAnimation", "setPedAnimation" ); lua_classfunction ( luaVM, "setAnimationProgress", "setPedAnimationProgress" ); lua_classvariable ( luaVM, "inVehicle", NULL, "isPedInVehicle" ); lua_classvariable ( luaVM, "ducked", NULL, "isPedDucked" ); lua_classvariable ( luaVM, "inWater", NULL, "isPedInWater" ); lua_classvariable ( luaVM, "onGround", NULL, "isPedOnGround" ); lua_classvariable ( luaVM, "onFire", "setPedOnFire", "isPedOnFire" ); lua_classvariable ( luaVM, "choking", "setPedChoking", "isPedChoking" ); lua_classvariable ( luaVM, "doingGangDriveby", "setPedDoingGangDriveby", "isPedDoingGangDriveby" ); lua_classvariable ( luaVM, "frozen", "setPedFrozen", "isPedFrozen" ); lua_classvariable ( luaVM, "headless", "setPedHeadless", "isPedHeadless" ); lua_classvariable ( luaVM, "armor", "setPedArmor", "getPedArmor" ); lua_classvariable ( luaVM, "fightingStyle", "setPedFightingStyle", "getPedFightingStyle" ); lua_classvariable ( luaVM, "gravity", "setPedGravity", "getPedGravity" ); lua_classvariable ( luaVM, "weaponSlot", "setPedWeaponSlot", "getPedWeaponSlot" ); lua_classvariable ( luaVM, "ammoInClipOfCurrentWeaponSlot", NULL, "getPedAmmoInClip" ); lua_classvariable ( luaVM, "weaponInCurrentWeaponSlot", NULL, "getPedWeapon" ); lua_classvariable ( luaVM, "target", NULL, "getPedTarget" ); lua_classvariable ( luaVM, "vehicleSeat", NULL, "getPedOccupiedVehicleSeat" ); lua_classvariable ( luaVM, "contactElement", NULL, "getPedContactElement" ); lua_classvariable ( luaVM, "totalAmmoInWeaponOfCurrentWeaponSlot", NULL, "getPedTotalAmmo" ); lua_classvariable ( luaVM, "vehicle", "warpPedIntoVehicle", "getPedOccupiedVehicle", OOP_WarpPedIntoVehicle, GetPedOccupiedVehicle ); // what about removePedFromVehicle? lua_classvariable ( luaVM, "dead", "killPed", "isPedDead" ); // Setting this to any value will still kill the ped. Should we special case this? lua_classvariable ( luaVM, "walkingStyle", "setPedWalkingStyle", "getPedWalkingStyle" ); //lua_classvariable ( luaVM, "stats", "setPedStat", "getPedStat", CLuaOOPDefs::SetPedStat, CLuaOOPDefs::GetPedStat ); // table //lua_classvariable ( luaVM, "controlState", "setPedControlState", "getPedControlState", CLuaOOPDefs::SetPedControlState, CLuaOOPDefs::GetPedControlState ); // TODO: .controlState["control"] = value // This commented code will syntax error, a new method has to be implemented to support this //lua_classvariable ( luaVM, "jetpack", {"removePedJetPack","givePedJetPack}, "doesPedHaveJetPack", CLuaOOPDefs::SetJetpackActive, "doesPedHaveJetPack" ); // very specialised! lua_registerclass ( luaVM, "Ped", "Element" ); }