scienziato-pazzo Posted January 12, 2014 Share Posted January 12, 2014 Hi, I want to format a string with a custom value from another string. Usually on other languages, like C++, I saw %s, but how to do it on LUA? Link to comment
Gallardo9944 Posted January 12, 2014 Share Posted January 12, 2014 do you mean string.gsub? Link to comment
scienziato-pazzo Posted January 12, 2014 Author Share Posted January 12, 2014 I saw the "?" operator, and the "??" operator, but how it works? Link to comment
TAPL Posted January 12, 2014 Share Posted January 12, 2014 http://lua-users.org/wiki/StringLibraryTutorial Link to comment
scienziato-pazzo Posted January 12, 2014 Author Share Posted January 12, 2014 Yes, but for example here (https://wiki.multitheftauto.com/wiki/DbQuery) I saw the "?" and the "??", but how do they work? Link to comment
TAPL Posted January 12, 2014 Share Posted January 12, 2014 This is just to make you able to put the string after the comma. So this: dbExec( connection, "UPDATE `??` SET `??`=?", tableName, columnName, columnValue ) Is the same as this: dbExec( connection, "UPDATE `tableName` SET `columnName`=columnValue" ) Link to comment
scienziato-pazzo Posted January 12, 2014 Author Share Posted January 12, 2014 Ooooh, thanks. But what's the difference between ?? and ?. Link to comment
Castillo Posted January 12, 2014 Share Posted January 12, 2014 I think that "??" is used for column and table names and "?" is used for values. Link to comment
scienziato-pazzo Posted January 12, 2014 Author Share Posted January 12, 2014 Ok, thanks. Link to comment
ixjf Posted January 12, 2014 Share Posted January 12, 2014 You can format strings in Lua with string.format. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now