我是Lua的新手,使用了一些教程,尝试了一些基本的东西,比如编写通用算法等。
但是我在我的mac os机器上使用lua解释器时遇到了一些问题。
例如,我们有一个名为'sample.lua‘的文件,其中包含以下代码行:
function fib(n) return n<2 and n or fib(n-1)+fib(n-2) end
如何从终端运行该函数?如果我不使用任何函数,我只需要使用'lua script.lua‘来调用脚本-工作!
下一个问题是关于非编译的lua-source和编译的lua-source之间的基本理解。为什么lua代码不需要编译就可以运行,就像我之前
我试图在Lua中加载以下C库:
#include <stdio.h>
#include <stdlib.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
void stackDump(lua_State* lua)
{
int i, t;
int top = lua_gettop(lua);
printf("Stack dump: ");
for (i = 1; i <= top; i++)
{
这是密码。目的是打印信息。在PrintC中,我想让e...but作为cdata到达。我怎么才能打开它或者绕过它呢?
extern "C"
{
static int PrintC ( lua_State *L )
{
// does not work cdata
//executor* e = ( executor* ) luaL_checkudata(L, 1, "cdata"); does n
//luaL_checkudata(L, 1, "void *");
我正在和Lua玩下面的链接:,并对一个点感到困惑。
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> x=10
> local i=1
> while i<=x do
>> local x = i*2
>> print(x)
>> i=i+1
>> end
stdin:1: attempt to compare nil with number
stack traceback:
stdin:1: in main chunk
[C]: in ?
我
我下载了mysql-async,essentialmode,esplugin_mysql,es_admin2,async,它显示了这个错误。 是关于什么的?请帮助我,我正在尝试创建我的服务器。 [ERROR] connect ETIMEDOUT
Connecting: kworthbati
Sending heartbeat to live-internal.fivem.net:30110
[ERROR] [MySQL] [esplugin_mysql] An error happens on MySQL for query
"SELECT
我对Lua很陌生。我使用将一个JS文件编译为Lua5.2
castl -o script.js
这创建了一个名为script.js.lua.的文件这是我的新lua文件的第一行:
local _ENV = require("castl.runtime");
我试着用lua52 script.js.lua运行该文件,但是我得到了以下错误:
C:\Program Files\lua-5.2.4_Win64_bin\lua52.exe: script.js.lua:1: module 'castl.runtime' not found:
no field
我正在尝试让Lua系统在我的.NET 4.0应用程序中工作。我使用LuaInterface作为Lua的包装器,它是在.NET 4.0下编译的
在我的安装了VS2010的开发计算机上运行Lua脚本时,应用程序运行得非常好。但是当在另一台计算机上运行它时,我得到了一个FileNotFoundException。
System.IO.FileNotFoundException: Could not load file or assembly 'lua51.dll' or one of its dependencies. The specified module could not b
基本上有另一个fivem es_extended问题,我得到了不受欢迎的错误,每次用户尝试加入我的服务器,并显示他们的钱未定义,也不允许他们保存他们的衣服。 我已经从我的数据库中删除了表,并重新添加了它们,但没有用。 stack traceback:
@es_extended/server/main.lua:155: in upvalue 'ref'
citizen:/scripting/lua/scheduler.lua:391: in function <citizen:/scripting/lua/scheduler.lua:390
我使用"lua.vm.js“在web客户端使用lua进行开发。
我想知道如何从js脚本调用Lua函数。
var element = document.getElementById("myBtn")
element.addEventListener("click", function(){ /*call here Lua function*/ });
当我试图从/写到文本文件时,在Lua中遇到了一个权限错误。正如您在下面看到的,我已经从io.open函数中提取了错误消息,并且我得到了"file.txt:权限被拒绝“。如果有帮助的话,我使用的是和Love2D引擎。
function fileWrite()
outputFile, error = io.open("new.txt", "w")
if outputFile then
for k,v in pairs(clicks) do
outputFile:write(tostring(v[1])
我在项目的根目录中有一个松散的实用程序脚本name.ts。当需要时,我使用ts-node调用它。此脚本在实际源代码中的任何位置都未被引用。 我的程序的实际源代码在src下。 每当我尝试运行tsc (在tsconfig.json中,rootDir被设置为./src)时,它抛出: error TS6059: File '/home/rijndael/projects/mc/js/lua/generate.ts' is not under 'rootDir' '/home/rijndael/projects/mc/js/lua/scripts-ts'