[Coding] Broken semicolon
RedSword
Join Date: 2006-12-07 Member: 58947Members, Reinforced - Shadow, WC 2013 - Supporter
Hi,
I was trying various arguments in lua for a function callback, but it seems I cannot find anyway to use a semicolon without breaking my argument.
If you type, with the code in the spoiler, "sv_testsemicolonarg2 qwe;qaz", the following will be shown :
And using the double-quotes doesn't solve the problem; 'sv_testsemicolonarg2 "qwe;qaz"' :
Also, if I only do "sv_testsemicolonarg2 ;", I get an error "failed attempt to contatenate local "aMsg" (a nil value).
I'd like to know how I am supposed to use semicolons in LUA. I did ask on discord and @SamusDroid (Samus on discord) told me to make a thread about it.
Code :
And on a side note, using "name ;;" in console gives a lua error : http://pastebin.com/x5c4khRu
And of course I am able to talk normally in chat using semicolons. Just never in console it seems. Also google didn't help much (so it doesn't seem to be LUA related).
Red
I was trying various arguments in lua for a function callback, but it seems I cannot find anyway to use a semicolon without breaking my argument.
If you type, with the code in the spoiler, "sv_testsemicolonarg2 qwe;qaz", the following will be shown :
1) Arg qwe 2) Arg qwe 3) Arg qwe
And using the double-quotes doesn't solve the problem; 'sv_testsemicolonarg2 "qwe;qaz"' :
1) Arg "qwe 2) Arg "qwe 3) Arg "qwe
Also, if I only do "sv_testsemicolonarg2 ;", I get an error "failed attempt to contatenate local "aMsg" (a nil value).
I'd like to know how I am supposed to use semicolons in LUA. I did ask on discord and @SamusDroid (Samus on discord) told me to make a thread about it.
Code :
local function CommandCallback_TestSemiColonArg1(aClient, myArg) Print("My arg = " .. myArg) -- can't use ... here end local function CommandCallback_TestSemiColonArg2(aClient, ...) local aMsg = "" local args = {...} -- used by Console_sv_spawnteams aMsg = StringConcatArgs(...) Print("1) Arg " .. aMsg) aMsg = "" -- same as OnCommandBind@ConsoleBindings.lua for arg = 1, #args do aMsg = aMsg .. args[arg] end Print("2) Arg " .. aMsg) aMsg = "" -- used by ClientSay / ClientTeamSay (normal chat) ; @Lucky fkers for _, word in ipairs(args) do if aMsg == "" then aMsg = word else aMsg = aMsg .. " " .. word end end Print("3) Arg " .. aMsg) end CreateServerAdminCommand("Console_sv_testsemicolonarg1", CommandCallback_TestSemiColonArg1, "") -- arg CreateServerAdminCommand("Console_sv_testsemicolonarg2", CommandCallback_TestSemiColonArg2, "") -- ...
And on a side note, using "name ;;" in console gives a lua error : http://pastebin.com/x5c4khRu
And of course I am able to talk normally in chat using semicolons. Just never in console it seems. Also google didn't help much (so it doesn't seem to be LUA related).
Red
Comments
I understand that; but that's the case even between double-quotes (i.e. '"qwe;qaz"'); shouldn't this be seen as a bug ? Shouldn't you be able to write anything that the game allow from within the console ? A bit like Source console (yes I know, not the same game/engine) ?
Edit : You can't even escape it with % or \
I don't code Lua. What kind of parser does it use? (UWE provided or Lua provided)
How about Link (Is this the official manual? I might be spoiled but this is horrible)
Red