Re: Lua in SAMP (alpha) -
Rancho - 19.08.2012
Exporting function from Script to other scripts completed.
0.2.1 is still developing...
Re: Lua in SAMP (alpha) -
Rancho - 20.08.2012
New version is now public.You can export functions now.For example;
test.lua:
pawn Код:
function IsValidAge(_match_str)
if (not tonumber(_match_str)) then return false; end
return tonumber(_match_str)>7 and tonumber(_match_str) <= 125;
end
export("IsValidAge",IsValidAge);
test2.lua
pawn Код:
exports.test:IsValidAge(21);
// or
call("CAccount", "IsValidAge", 21);
Like this,
The first string in export, what's the function name to export other scripts
Second parameter is which function..
Re: Lua in SAMP (alpha) -
Optimus_Sprite - 20.08.2012
I want to get an example with addEventHandler, because i got error: Bad argument @ addEventHandler
Re: Lua in SAMP (alpha) -
Rancho - 20.08.2012
Quote:
Originally Posted by Optimus_Sprite
I want to get an example with addEventHandler, because i got error: Bad argument @ addEventHandler
|
New download added, fixed some bugs..
addEventHandler(name, rootID, function)
rootID = Event called for who, -1 is for all
addEventHandler('onPlayerConnect', -1, function) -- all players
addEventHandler('onPlayerConnect',0,function) -- for id 0 only
rootID usually first parameter in the publics.
Re: Lua in SAMP (alpha) -
Arca - 20.08.2012
Quote:
Originally Posted by Rancho
New download added, fixed some bugs..
addEventHandler(name, rootID, function)
rootID = Event called for who, -1 is for all
addEventHandler('onPlayerConnect', -1, function) -- all players
addEventHandler('onPlayerConnect',0,function) -- for id 0 only
rootID usually first parameter in the publics.
|
How to call custom function? For example I have SendPlayerFormattedMessage.
Re: Lua in SAMP (alpha) -
Rancho - 21.08.2012
Quote:
Originally Posted by Arca
How to call custom function? For example I have SendPlayerFormattedMessage.
|
In pawn or in lua?
Re: Lua in SAMP (alpha) -
Toni - 21.08.2012
Quote:
Originally Posted by TheArcher
I read almost all the replies about LUA used by MTA. I'm pretty sure that it's also used mostly for new mods and source engine (CSS, GarrysMod etc...).
|
Yeah most games on SE do besides CSS and TF2. They actually use PAWN. Which is a huge benefit for us SA:MP coders because you can run right over there and start doing all the stuff you want. SourceMod is based on AMX Mod.
Congratulations on this release though, it's very nice.
Re: Lua in SAMP (alpha) -
Rancho - 21.08.2012
Linux version is coming
Just last 1-2 edit...
Respuesta: Lua in SAMP (alpha) -
Rancho - 21.08.2012
Linux version added.
Re: Lua in SAMP (alpha) -
Arca - 22.08.2012
Quote:
Originally Posted by Arca
How to call custom function? For example I have SendPlayerFormattedMessage.
|
Can someone help me out?