Все вопросы: [lua]
227 вопросов
почему я получаю «попытка вызвать глобальный запрос» (нулевое значение) »?
У меня есть 3 файла lua, Init.lua, FreeCamera.lua и Camera.lua, Для вызовов init.lua требуется "Core.Camera.FreeCamera" Бесплатная камера: module(...) require "Core.Camera.Camera" local M = {} FreeCamera = M M = Class( Camera ) function M:__constructor(x,y,z) self.Active = false s...
Как установить "требуемый" путь, когда lua встроен?
В мой игровой движок встроен lua и структура каталогов файлов lua, и я начинаю использовать множество сценариев lua.Я хочу использовать «requrie» для оптимизации включения модуля, но я не уверен, как установить значения CPATH и PATH, потому что у меня есть встроенный lua.Как я могу это настроить...
Включить цвет вывода bash с помощью скрипта Lua
У меня есть несколько сценариев Lua, которые запускают опыт и выводят большой объем информации в текстовые файлы и в консоль.Я хотел бы добавить несколько цветов в вывод консоли, чтобы он был более читабельным. Я знаю, что можно раскрасить вывод сценариев bash, используя escape-последовательн...
Lua подключается к MySQL
У меня есть веб-приложение на Lua. Я хочу подключиться и запросить мою базу данных MySQL.Я искал в Google и т. Д., Но не нашел хорошего способа сделать это из Lua. Есть идеи, как я могу подключиться и запросить мой MySQL из моего веб-приложения Lua? Спасибо
Каков наилучший способ вывода отладки для сборщика мусора lua?
Мне нужен объект состояния игры в lua (не C ++ или привязанный к C ++) для управления освещением, камерами, объектами и событиями из моего движка C ++ (объекты lua - это отдельные сущности от C ++, довольномного стандартных таблиц lua).Меня беспокоит, как будет действовать сборщик мусора при у...
Как создать каталог в Lua?
Можно ли создать каталог на lua?Если да, то как?
привязки wxlua не работают с моими теневыми объектами, созданными с использованием SWIG
Я создал класс, используя wxwdigets //wrapper over wxIPV4address class IPV4addressLua : public wxIPV4address { public: IPV4addressLua(); ~IPV4addressLua(); bool SetService (const wxString &service); bool SetService (unsigned short...
Ошибка распаковки Lua?
Я обнаружил странное поведение функции распаковки Lua table1 = {true, nil, true, false, nil, true, nil} table2 = {true, false, nil, false, nil, true, nil} a1,b1,c1,d1,e1,f1,g1 = unpack( table1 ) print ("table1:",a1,b1,c1,d1,e1,f1,g1) a2,b2,c2,d2,e2,f2,g2 = unpack( table2 ) print ("table2:",...
Функции в таблице - Lua
У меня есть таблица, в которой есть несколько функций.Я пытаюсь написать одну функцию, которая будет использовать все функции, передавая в нее случайную информацию. Методы = {} вставка функций в таблицу методов Методы функции: Multi () if #self> 0 тогда ..................
Может ли Lua "тайм-аут"?
Допустим, я запускаю скрипт, и игровой клиент ожидает завершения скрипта перед его обновлением.Может ли Lua сделать что-то вроде «тайм-аута»?Например, могу ли я установить приоритет обновления, чтобы он оставил скрипт для выполнения обновления, а затем, после слов, смог бы он вернуться туда, где...
Сортировка таблиц дважды в одной функции - Lua
Хотите, чтобы функция сортировала таблицу по HP, но если HP дублируются, то сортирует по имени.Когда я запускаю эту функцию, она просто группирует повторяющиеся HP вместе в произвольном порядке по имени. T = { {Name = "Mark", HP = 54, Breed = "Ghost"}, {Name = "Stan", HP = 24, Breed = "Zombie...
Таблицы сортировки - Lua
Я пытаюсь выполнить сортировку, но ничего не найдено.Как я могу обойти это? Код, который я использую: (сортировка по имени и HP. на случай дублирования HP) T = { {Name = "Mark", HP = 54, Breed = "Ghost"}, {Name = "Stan", HP = 24, Breed = "Zombie"}, {Name = "Juli", HP = 100, B...
Lua - Таблица в таблице Печать и сортировка
T = { {Name = "Mark", HP = 54, Breed = "Ghost"}, {Name = "Stan", HP = 24, Breed = "Zombie"}, {Name = "Juli", HP = 100, Breed = "Human"}}, Вопросы: Как мне напечатать только имена? и Как отсортировать по HP?
Lua Alien - вызов специального API
В настоящее время я столкнулся с проблемой, играя с Lua и чужим модулем, чтобы использовать Win32 API и тому подобное из сценариев Lua. До сих пор у меня была только одна проблема с alien, которая связана с использованием API, использующего определенные структуры, такие как CreateFontIndirect. ...
Сохранить ссылку на пользовательские данные Lua
# 1 Lua: local test = Test(); # 2 C: //creating "lua's test" luaL_newmetatable(L, "someTable"); lua_userdata *userData = (lua_userdata *)lua_newuserdata(L, sizeof(lua_userdata)); luaL_getmetatable(L, "someTable"); lua_setmetatable(L, -2); # 3 Lua: function test.newMethod() end ...
Есть ли у прототипов Javascript что-то эквивалентное Lua __index & __newindex?
Я хочу определить поведение объектов Javascript, которое срабатывает, когда указанный атрибут / метод не существует. В Lua это можно сделать с помощью метатаблиц и методов __index & __newindex. --Lua code o = setmetatable({},{__index=function(self,key) print("tried to undefined key",ke...
Eclipse не распознает файлы lua после установки плагина lua
Я загрузил Eclipse Classic с веб-сайта Eclipse, затем Lua Eclipse IDE plugin .Я выполнил инструкции по установке, но Eclipse, похоже, не распознает или не может понять файлы lua.Кто-нибудь может помочь?
Как создать вложенные таблицы Lua с помощью C API
Я хочу создать такую таблицу myTable = { [0] = { ["a"] = 4, ["b"] = 2 }, [1] = { ["a"] = 13, ["b"] = 37 } } используете C API? Мой текущий подход lua_createtable(L, 0, 2); int c = lua_gettop(L); lua_pushstring(L, "a"); lua_pushnumber(L, 4); lua_settable(L, c); lua_pushstring...
Placeholder evaluation of lua code
I have an application that uses lua files for some of its more obscure configuration options. As such it mostly contains calls into the app to create things and alter properties; most C functions don't have a return value but some do. I now have a need to read these same configuration files int...
Luabind Function using std::string& Reference with pure_out_value policy not possible?
I'am trying to return a string from a function but it doesn't compile. When I replace the std::string& type with int& it compiles, however I want to return additionally to the boolean a std::string how do I do this? bool luacw_getElementContent( std::string name, std::string& content...
DllNotFoundException while trying to "fix" LuaInterface, but why?
Since my game, which I'd really like to be Mono-usable, does not seem to run under Linux because LuaInterface is being a jerk (see the the relevant SO thread for more on that), I've decided to do what's suggested there. I wrote my own Lua511.LuaDLL class to reflect the one used by LuaInterface, r...
How to include lua scripting language into C++ XCode?
I have successfully compiled lua in my mac. It works. It runs. Now, I want to mix it with C++ in XCode. So I looked up in the Linked Library, the usual place to add more libraries in XCode. But of course, lua isn't there. Now, how do I tell XCode the existence of lua so that the program can inclu...
Using Lua for working with excel
I am planning to learn Lua for my desktop scripting needs. I want to know if there is any documentation available and also if there are all the things needed in the Standard Lib.
Passing 2d array to function in Lua
It is possible to pass 2d array to a function as a paramter ? I initialized an array like this : tab={} for i=1, 10 do tab[i]={} for z=1, 10 do tab[i][z]= 0 end end and i have function like this : function foo(data) ... x = data[i][z] -- here i got error ... e...
Resource for learning Lua to use with C++?
So I have heard that Lua is a good scripting language that ties into C++. Does anyone know some good resources for picking it up, for someone with lots of C++ experience?
How to use LuaInterface on Mono/Linux
When I try to use LuaInterface on Mono on Linux (using Mono 2.0 on Ubuntu 9.04) I get the following exception: ** (App.exe:8599): WARNING **: Method ':.DoDllLanguageSupportValidation ()' in assembly '/home/ulrich/test/Debug/lua51.dll' contains native code that cannot be executed by Mono on th...
How can I load and execute a lua file from within another lua file
I have a lua script which is run using the command line interpreter, the script needs to load a table from a file. The table is stored like this: create_object_action = { reflexive = true, which_base_type = 29, how_many_min = 1, how_many_range = 0, velocity_relative = false, ...
Template casting issue
I seem to be getting an error in the below code when I attempt to cast to a template of class T, when T is of type float. I have realized already that a type of int functions correctly, because the following is valid syntax: char* str = "3"; int num = (int)str; The same is not true of float. ...
SWIG / Lua: Determine member field data type
SWIG graciously provides the swig_type() function to get a string representation of the data type of a passed userdata object. However, in the case of member fields, SWIG and Lua consider those to be simple "number" items and so prints only "number" instead of the data type's name. e.g. typedef...
Lua's bytecode specification
Can anyone tell me where to find Lua's bytecode specification? I've been searching for 15 minutes, and I can't find anything.