当前位置:网站首页>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))
边栏推荐
- PHP common sorting algorithm
- Enter three times and guess a number
- Go language foundation ----- 19 ----- context usage principle, interface, derived context (the multiplexing of select can be better understood here)
- Unity dotween sequence animation replay problem.
- Redis view client connection
- jsutlis
- P2704 [NOI2001] 炮兵阵地(状压dp)
- Structure of golang
- Worldview satellite remote sensing image data / meter resolution remote sensing image
- [MySQL 13] if you change your password for the first time after installing mysql, you can skip MySQL password verification to log in
猜你喜欢

Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does

STM32F103 SPI (pit Diary)

*p++、*++p、++*p、(*p)++

【踩坑系列】mysql 修改root密码失败

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

vcs import src < ros2. Repos failed

Technical dry goods | thinking about the unification of dynamic and static diagrams of AI framework

创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
![[MySQL 14] use dbeaver tool to remotely backup and restore MySQL database (Linux Environment)](/img/38/3435d353e50b19fe09c8ab9db52204.png)
[MySQL 14] use dbeaver tool to remotely backup and restore MySQL database (Linux Environment)

Viz artist advanced script video tutorial -- stringmap use and vertex operation
随机推荐
Technical dry goods | thinking about the unification of dynamic and static diagrams of AI framework
idea取消引用显示效果
[untitled]
华为交换机Console密码重置、设备初始化、默认密码
Ventuz Foundation Series "one step at the door"
oracle 插入单引号
static关键字
Static keyword
一条通往服务器所有端口的隧道
Introduction of novel RNA based cancer therapies
Go language foundation ------ 12 ------ JSON
Redis批量启停脚本
Technical dry goods Shengsi mindspire dynamic transformer with variable sequence length has been released!
C2-关于VCF文件合并的几种方法
OSPF protocol summary
yarn link 是如何帮助开发者对 NPM 包进行 debug 的?
[at] abc 258G - Triangle 三元组可达-暴力
Huawei switch basic configuration (telnet/ssh login)
【cocos creator】点击按钮切换界面
[at] ABC 258g - triple Reach - violence