How can I use Chinese letters for locals lua

Viewed 96

im trying to make locals with Chinese letters

local 屁 = p 
or 
屁 = p

none of those work any ways to do it?

1 Answers

You can't do this as "屁" is not a valid Lua identifier.

Lua identifiers can only have letters, numbers and underscores and must not start with a number.

However, you can create a table with a key 屁:

local chinese_letters = {
    ["屁"] = p
}

And access it as chinese_letters["屁"], for example

local chinese_letters = {
    ["屁"] = 10
}

print(chinese_letters["屁"])

By the way, the correct name for these chinese characters is Hanzi

Related