Quote:
Originally Posted by Logofero
I like that it is offered as an alternative Pawn, but there is already a plugin allows you to work with Lua in the sа-mp.
Good job.
PS: Need a wiki will be even more popular
Add example:
I agree it is nice (LUA):
PHP код:
-- Declaration new function
function sendMsgToPlayer(playerid, color, form, ...)
sendClientMessage(playerid, color, string.format(form, ...))
end
-- Test formatted messages
sendMsgToPlayer(playerid, -1, "integer %d text '%s' float %.1f", 1, "text and smile :)", 100.0)
what is so (PAWNO):
PHP код:
// Sending a formatted message..
new msg[256];
format(msg, sizeof(msg), "integer %d text '%s' float %.1f", 1, "text and smile :)", 100.0);
SendClientMessage(playerid, -1, msg);
And the result is the same in chat:
Код:
integer 1 text 'text and smile :)' float 100.0
|
Actually you dont need to format the string. LUA has support for string-concatenation.
Код:
print("Hello " .. "World") --> Hello World
print(0 .. 1) --> 01
Код:
a = "Hello"
print(a .. " World") --> Hello World
print(a) --> Hello