Lua to Luau conversion guide: Difference between revisions

From GiderosMobile
Created page with "Macros are no longer present, you will need to change macro constants to variables: e.g. maxLives@5 change to: maxLives=5 string.gsub patterns act slightly different when rep..."
 
No edit summary
Line 1: Line 1:
Macros are no longer present, you will need to change macro constants to variables:
'''Macros are no longer present, you will need to change macro constants to variables:'''
 
e.g.
e.g.
maxLives@5
maxLives@5
change to:
change to:
maxLives=5
maxLives=5


string.gsub patterns act slightly different when replacing a character that is special, you need to remove the second %
 
'''string.gsub patterns act slightly different when replacing a character that is special, you need to remove the second %'''
 
e.g.
e.g.
string.gsub(myString,"%+","%-")
string.gsub(myString,"%+","%-")
change to:
change to:
string.gsub(myString,"%+","-")
string.gsub(myString,"%+","-")


Lua shaders need to have a slight change to the way they are defined:
 
'''Lua shaders need to have a slight change to the way they are defined:'''
 
e.g.
e.g.
function vertex(vVertex,vColor,vTexCoord)
function vertex(vVertex,vColor,vTexCoord)
change to:
change to:
function vertex(vVertex,vColor,vTexCoord):Shader
function vertex(vVertex,vColor,vTexCoord):Shader

Revision as of 17:34, 30 December 2021

Macros are no longer present, you will need to change macro constants to variables:

e.g.

maxLives@5

change to:

maxLives=5


string.gsub patterns act slightly different when replacing a character that is special, you need to remove the second %

e.g.

string.gsub(myString,"%+","%-")

change to:

string.gsub(myString,"%+","-")


Lua shaders need to have a slight change to the way they are defined:

e.g.

function vertex(vVertex,vColor,vTexCoord)

change to:

function vertex(vVertex,vColor,vTexCoord):Shader