[Overview][Types][Classes][Procedures and functions] |
Source position: plua.pas line 18
function plua_tostring( |
L: Plua_State; |
Index: Integer |
):ansistring; |
L |
|
PLua_State to work with. |
Index |
|
Stack index to convert/return. |
AnsiString representing the lua item on the stack at the index provided.
Converts the Lua value at the given acceptable index to a Pascal AnsiString. The Lua value must be a string or a number; otherwise, the function returns NULL. If the value is a number, then plua_tostring also changes the actual value in the stack to a string. (This change confuses lua_next when plua_tostring is applied to keys during a table traversal.)
Example:
function lua_print(l : PLua_State) : integer; cdecl; var n, c : Integer; AString : AnsiString; begin result := 0; n := lua_gettop(L); AString := ''; for c := 1 to n do AString := AString + plua_tostring(l, c); Write(AString); end;
|