当前位置:网站首页>Lua hot update basic grammar
Lua hot update basic grammar
2022-07-03 07:57:00 【qq_ two billion three hundred and eighty-five million seven hun】
1, What is hot update
Hot updates can be done without downloading the client again , Update the content of the game .
2, Why? C# Scripts cannot be updated directly
C# You need to compile before running dll file , This compilation process cannot be completed on mobile platforms
3, What is? AssetBundle
Resource renewal Technology , It is through AssetBundle, We can go through AssetBundle Update game UI, You can also package scripts or other code as resources AssetBundle Then update to the client .
Lua It is a powerful and compact scripting language , Parsing can be run across platforms , And there is no need to compile
4, How to use it Lua Hot update
You can write Lua The parser , Through this parser , You can run the latest Lua Script , Then we write the code that controls the logic of the game Lua Script
5, How to learn hot renewal Technology
1, Study Lua Programming
2, Learn to pass LuaInterface and luanet Conduct Lua and C# Interactive communication
3, Learn to use AssetBundle Update resources
4, Study uLua SimpleFramework
6,Lua What is it
Embedded in the application , Flexible extension and customization for applications ,
Lua There is a simultaneous JIT project , Provides instant compilation on a specific platform .
Luaforwindows
http://luaforwindows.luaforge.net/
( Installable exe file , A whole set of Lua development environment , Yes Lua Interpreter , Reference manual , Examples and libraries , file , And editor )
lua Open under the installation directory SciTE.exe,lua The suffix of the file is .lua, Press down F5 function
7, How to define variables
num= 100
stay Lua Variables defined in are of no type , According to what data is stored , To decide what type
How to add comments
1, Single-line comments -- The comment
2, Multiline comment --[[ Here are the notes ]]--
Lua The types of variables in are as follows :
1,nil Represents empty data , Equate to null
2,boolean Boolean type , Storage true and false
3,string String type , Strings can be expressed in double quotation marks or single quotation marks
4,number Decimal type (Lua There is no integer type in )
5,table Table type
myTable = {34,34,2,342,4}
myTable[3]
We can use type() To get the type of a variable
matters needing attention
All variables defined by default are global , To define a local variable, you need to add a local;
Local variables declared in a code block , At the end of contemporary code block operation , This variable will be released ;
temp= 34
local var = 345
if Usage of sentences
local hp = 40
if hp<=0 then
print("role is die")
elseif hp>=50 then
print("role is good")
else
print("role is bad")
endLoop structure while loop
index = 1
while index<=100 do
print(index)
index=index+1
endLoop structure repeat loop
repeat
print(index)
index=index+1
until index>100for Loop structure
sum = 0
for index = 1,100 do
sum=sum+index
end
print(sum)function ( Method )
function Plus(num1,num2)
return num1+num2
end
res = Plus(34,45)
print(res)
Mathematical operation function
math.abs -- Take the absolute value
math.cos -- Take trigonometric function
math.max
math.maxinteger
math.min
math.random
math.sin
math.sqrt
math.tan
String processing related functions
string.byte
string.char
string.find
sting.format
string.lower
string.sub
string.upper
.. String addition
tostring() Convert a number into a string
tonumber() Convert a string into a number
table surface
stay Lua Medium table similar C# Dictionary in , It's really just a key-value Data structure of key value pair .
1,table The creation of
myTable = {}
Use after the table name {} assignment , Represents an empty table
2,table Assignment
myTable[3]=34 The assignment method when the key is a number
myTable["name"]="taikr" When the key is a string assignment
myTable.name = "siki" When the key is a string assignment
3,table The interview of
myTable[3] When the key is a number , There is only one way to access
myTable.name When the key is a string, there are two ways to access
myTable["name"]
Table related functions
1.table.concat, Connect all the data in the table into a string
2,table.insert, Insert a data into the specified location
3,table.move, mobile data
4,table.pack, Pack it into a watch
5,table.remove, Remove the data from the specified location
6,table.sort, Sort
7,table.unpack, Returns an array , An array of specified ranges
--[[
myTable={}
myTable[1]=34
myTable[3]="sdf"
myTable["name"] = "taikr"
myTable.name = "siki"
print(myTable[1] ,myTable.name,myTable["name"] )
myTable = {name="taikr",age=18,isMan = false}
myTable.school = " Tyco online "
print(myTable.isMan,myTable.school )
]]--
--scores = {34,56,123,6734,23}
--print( scores[1] )
--for index=1,table.getn(scores) do
--print( scores[index] )
--end
--[[
myTable = {name="taikr",age=18,isMan = false}
for index,value in pairs(myTable) do
print(index,value)
end
]]--
myTable = {name="taikr",age=18,isMan = false}
scores = {34,56,123,6734,23}
table.insert( myTable,2,2 ) -- myTable[2]=2
table.remove(scores,3)
table.sort(scores)
print( table.concat(scores))
边栏推荐
猜你喜欢

【LeetCode】3. Merge two sorted lists · merge two ordered linked lists

The difference between hdmi2.1 and hdmi2.0 and the conversion of PD signals.

Worldview satellite remote sensing image data / meter resolution remote sensing image

Professor Zhang Yang of the University of Michigan is employed as a visiting professor of Shanghai Jiaotong University, China (picture)

freetype库的移植
![[MySQL 11] how to solve the case sensitive problem of MySQL 8.0.18](/img/9b/db5fe1a37e0de5ba363f9e108310a5.png)
[MySQL 11] how to solve the case sensitive problem of MySQL 8.0.18

Pat class a 1030 travel plan

Redis批量启停脚本

An intern's journey to cnosdb

Iterm2 setting
随机推荐
Go language foundation ------ 14 ------ gotest
华为交换机配置ssh登录远程管理交换机
Structure of golang
HDMI2.1与HDMI2.0的区别以及转换PD信号。
【LeetCode】4. Best time to buy and sell stock
IP production stream is so close to me
Uniapp learning records
Client server model
RM delete file
Go language foundation ----- 08 ----- interface
LwIP learning socket (application)
An article for you to understand - Manchester code
YOLO系列 --- xml2txt脚本
Pat grade a 1027 colors in Mars
[untitled]
Unity XR realizes interaction (grasping, moving, rotating, transmitting, shooting) -pico
WPF:解决MaterialDesign:DialogHost 无法关闭问题
vcs import src < ros2. Repos failed
Unity dotween sequence animation replay problem.
MAE