增加文档

This commit is contained in:
lostluna1
2025-10-17 23:37:16 +08:00
parent f00a65e2f8
commit a9b10b88c0
8 changed files with 450 additions and 165 deletions

View File

@@ -0,0 +1,83 @@
//Type Squirrel的类型名称与squirrel一致
//integer->整数
//float->浮点数
//array或者[]代表任意类型数组
//table->{}
//string->字符串
//boolean->布尔值
//文档注释中指定类型的数组应该这么做
/**
* Description placeholder
* @param {array(integer)} args
*/
function arrayExample(args) {}
//任意类型的数组应该这么做
/**
*
* @function
* @param {array} args
* @returns {void} //如果不写@returns 代表返回null{void}或{*}代表返回any
*/
function anyArrayExample(args) {}
//以下是其他类型的文档注释示例
/**
*
* @function
* @param {integer} args
* @returns {void}
*/
function intExample(args) {}
/**
*
* @function
* @param {float} args
* @returns {void}
*/
function floatExample(args) {}
/**
* Description placeholder
* @param {string} args
*/
function stringExample(args) {}
/**
*
* @function
* @param {boolean} args
* @returns {void}
*/
function boolExample(args) {}
/**
*
* @function
* @param {table} args
* @returns {void}
*/
function tableExample(args) {}
//以下是内联提示与hover
local a = 1;
local b = "1";
local c = 1.1;
local d = false;
local t = {};
local arr = [];
local intArr = [1];
local floatArr = [1.1];
local strArr = ["str"];
local anyArr = [];
//以下是二元表达式类型推断
local x = 1 + 1;
local x1 = 1 / 1;
local x2 = 1 * 0.1;
local x3 = (1 + 1).tofloat() + (1 / 2).tofloat();