02-15-2013, 07:29 AM
02-15-2013, 07:34 AM
No, it's not.
The easiest way to check out the API is to temporarily enable the Debuggers plugin, it will output all available API functions into a file, API.txt, next to the MCServer.exe executable.
The easiest way to check out the API is to temporarily enable the Debuggers plugin, it will output all available API functions into a file, API.txt, next to the MCServer.exe executable.
02-15-2013, 07:52 AM
thanks i now have a list of all the API functions
however i don't know how to use most of those functions
i am trying to make a chat plugin so you can see your group and i have this code:


i am trying to make a chat plugin so you can see your group and i have this code:
Server:SendMessage( Group:GetColor() .. "[" .. Group:GetName() .. "]" .. Player:GetColor() .. Player:GetName() .. ": " .. cChatColor.LightGray .. Message )howerver i get this error all the time:
Code:
LUA: Plugins/Test/main.lua:17: attempt to index global 'Group' (a nil value)
Error in plugin chat calling function OnChat()
02-15-2013, 08:05 AM
1, A player may be a member of multiple groups, so this idea's not gonna work at all
2, What is Group in your code, is it a variable? because it definitely isn't a class name. The Lua error is telling you basically that you're using an undefined thing called "Group"
3, To see parameters for API functions, have a look at the bottom of Bindings.cpp file, there's a huuuge tolua_AllToLua_open() function that glues Lua to C++, find your class and function there and have a look at how it's glued. For example, cCraftingRecipe:GetIngredient() is glued in tolua_AllToLua_cCraftingRecipe_GetIngredient00() function, if you look that one up, you'll see that it takes one "const cCraftingRecipe" parameter (that's the Lua's hidden first parameter, denoted by using a colon instead of a dot), two number parameters and nothing more, it calls cCraftingRecipe's GetIngredient C++ function and then returns one result, "cItem".
2, What is Group in your code, is it a variable? because it definitely isn't a class name. The Lua error is telling you basically that you're using an undefined thing called "Group"
3, To see parameters for API functions, have a look at the bottom of Bindings.cpp file, there's a huuuge tolua_AllToLua_open() function that glues Lua to C++, find your class and function there and have a look at how it's glued. For example, cCraftingRecipe:GetIngredient() is glued in tolua_AllToLua_cCraftingRecipe_GetIngredient00() function, if you look that one up, you'll see that it takes one "const cCraftingRecipe" parameter (that's the Lua's hidden first parameter, denoted by using a colon instead of a dot), two number parameters and nothing more, it calls cCraftingRecipe's GetIngredient C++ function and then returns one result, "cItem".
02-15-2013, 08:38 PM
You could use the first group a player is in and prefix that to the chat messages