mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-19 06:15:08 +03:00
Merge pull request #3105 from opentx/projectkk2glider/lua_additions_for_next
Lua addition ported from master to next
This commit is contained in:
commit
84bd62bdce
11 changed files with 87 additions and 41 deletions
|
@ -24,3 +24,15 @@ MACRO (NOW RESULT)
|
||||||
ENDIF (WIN32)
|
ENDIF (WIN32)
|
||||||
ENDMACRO (NOW)
|
ENDMACRO (NOW)
|
||||||
|
|
||||||
|
MACRO (GIT_ID RESULT)
|
||||||
|
IF (WIN32)
|
||||||
|
EXECUTE_PROCESS(COMMAND "cmd" " /C git rev-parse HEAD" OUTPUT_VARIABLE ${RESULT})
|
||||||
|
string(REGEX REPLACE "(..):(..).*" "\\1:\\2:00" ${RESULT} ${${RESULT}})
|
||||||
|
ELSEIF(UNIX)
|
||||||
|
EXECUTE_PROCESS(COMMAND "git" "rev-parse" "HEAD" OUTPUT_VARIABLE ${RESULT})
|
||||||
|
string(REGEX REPLACE "(.*)\n" "\\1" ${RESULT} ${${RESULT}})
|
||||||
|
ELSE (WIN32)
|
||||||
|
MESSAGE(SEND_ERROR "Git ID implemented")
|
||||||
|
SET(${RESULT} 0)
|
||||||
|
ENDIF (WIN32)
|
||||||
|
ENDMACRO (GIT_ID)
|
||||||
|
|
|
@ -70,6 +70,7 @@ add_custom_target(firmware_translations DEPENDS ${translations_files})
|
||||||
|
|
||||||
TODAY(DATE)
|
TODAY(DATE)
|
||||||
NOW(TIME)
|
NOW(TIME)
|
||||||
|
GIT_ID(GIT_STR)
|
||||||
|
|
||||||
configure_file(${RADIO_SRC_DIRECTORY}/stamp.h.in ${RADIO_SRC_DIRECTORY}/stamp.h @ONLY)
|
configure_file(${RADIO_SRC_DIRECTORY}/stamp.h.in ${RADIO_SRC_DIRECTORY}/stamp.h @ONLY)
|
||||||
|
|
||||||
|
|
|
@ -422,6 +422,7 @@ namespace NAMESPACE {
|
||||||
#include "radio/src/thirdparty/Lua/src/ltablib.c"
|
#include "radio/src/thirdparty/Lua/src/ltablib.c"
|
||||||
#include "radio/src/thirdparty/Lua/src/lcorolib.c"
|
#include "radio/src/thirdparty/Lua/src/lcorolib.c"
|
||||||
#include "radio/src/thirdparty/Lua/src/liolib.c"
|
#include "radio/src/thirdparty/Lua/src/liolib.c"
|
||||||
|
#include "radio/src/thirdparty/Lua/src/lstrlib.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int16_t g_anas[NUM_STICKS+NUM_POTS];
|
int16_t g_anas[NUM_STICKS+NUM_POTS];
|
||||||
|
|
|
@ -404,7 +404,11 @@ else
|
||||||
endif
|
endif
|
||||||
TRANSLATE = -$(PYTHON) ../util/translate.py
|
TRANSLATE = -$(PYTHON) ../util/translate.py
|
||||||
|
|
||||||
VERSION = 2.2.0$(OPENTX_VERSION_SUFFIX)
|
VERSION_MAJOR = 2
|
||||||
|
VERSION_MINOR = 2
|
||||||
|
VERSION_REVISION = 0
|
||||||
|
|
||||||
|
VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_REVISION)$(OPENTX_VERSION_SUFFIX)
|
||||||
|
|
||||||
THIRDPARTY = thirdparty
|
THIRDPARTY = thirdparty
|
||||||
COOSDIR = $(THIRDPARTY)/CoOS
|
COOSDIR = $(THIRDPARTY)/CoOS
|
||||||
|
@ -1036,7 +1040,7 @@ ifeq ($(PCB), TARANIS)
|
||||||
CPPSRC += lua/interface.cpp lua/api_general.cpp lua/api_lcd.cpp lua/api_model.cpp
|
CPPSRC += lua/interface.cpp lua/api_general.cpp lua/api_lcd.cpp lua/api_model.cpp
|
||||||
LUASRC = $(LUADIR)/lapi.c $(LUADIR)/lcode.c $(LUADIR)/lctype.c $(LUADIR)/ldebug.c $(LUADIR)/ldo.c $(LUADIR)/ldump.c $(LUADIR)/lfunc.c $(LUADIR)/lgc.c $(LUADIR)/llex.c $(LUADIR)/lmem.c \
|
LUASRC = $(LUADIR)/lapi.c $(LUADIR)/lcode.c $(LUADIR)/lctype.c $(LUADIR)/ldebug.c $(LUADIR)/ldo.c $(LUADIR)/ldump.c $(LUADIR)/lfunc.c $(LUADIR)/lgc.c $(LUADIR)/llex.c $(LUADIR)/lmem.c \
|
||||||
$(LUADIR)/lobject.c $(LUADIR)/lopcodes.c $(LUADIR)/lparser.c $(LUADIR)/lstate.c $(LUADIR)/lstring.c $(LUADIR)/ltable.c $(LUADIR)/lrotable.c $(LUADIR)/ltm.c $(LUADIR)/lundump.c $(LUADIR)/lvm.c $(LUADIR)/lzio.c \
|
$(LUADIR)/lobject.c $(LUADIR)/lopcodes.c $(LUADIR)/lparser.c $(LUADIR)/lstate.c $(LUADIR)/lstring.c $(LUADIR)/ltable.c $(LUADIR)/lrotable.c $(LUADIR)/ltm.c $(LUADIR)/lundump.c $(LUADIR)/lvm.c $(LUADIR)/lzio.c \
|
||||||
$(LUADIR)/lbaselib.c $(LUADIR)/linit.c $(LUADIR)/lmathlib.c $(LUADIR)/lbitlib.c $(LUADIR)/loadlib.c $(LUADIR)/lauxlib.c $(LUADIR)/ltablib.c $(LUADIR)/lcorolib.c $(LUADIR)/liolib.c
|
$(LUADIR)/lbaselib.c $(LUADIR)/linit.c $(LUADIR)/lmathlib.c $(LUADIR)/lbitlib.c $(LUADIR)/loadlib.c $(LUADIR)/lauxlib.c $(LUADIR)/ltablib.c $(LUADIR)/lcorolib.c $(LUADIR)/liolib.c $(LUADIR)/lstrlib.c
|
||||||
SRC += $(LUASRC)
|
SRC += $(LUASRC)
|
||||||
LUADEP = lua/lua_exports_taranis.inc
|
LUADEP = lua/lua_exports_taranis.inc
|
||||||
ifeq ($(USE_BIN_ALLOCATOR), YES)
|
ifeq ($(USE_BIN_ALLOCATOR), YES)
|
||||||
|
@ -1785,9 +1789,23 @@ sym: $(TARGET).sym
|
||||||
|
|
||||||
# Build stamp-file
|
# Build stamp-file
|
||||||
stamp.h:
|
stamp.h:
|
||||||
|
@echo "// Automatically generated file (Makefile) - do not edit" > stamp.h
|
||||||
@echo "#define DATE \"`date +%Y-%m-%d | tr -d '\r\n'`\"" > stamp.h
|
@echo "#define DATE \"`date +%Y-%m-%d | tr -d '\r\n'`\"" > stamp.h
|
||||||
@echo "#define TIME \"`date +%H:%M:%S | tr -d '\r\n'`\"" >> stamp.h
|
@echo "#define TIME \"`date +%H:%M:%S | tr -d '\r\n'`\"" >> stamp.h
|
||||||
@echo "#define VERSION \"$(VERSION)\"" >> stamp.h
|
@echo "#define VERSION \"$(VERSION)\"" >> stamp.h
|
||||||
|
@echo "" >> stamp.h
|
||||||
|
@echo "#define VERSION_MAJOR $(VERSION_MAJOR)" >> stamp.h
|
||||||
|
@echo "#define VERSION_MINOR $(VERSION_MINOR)" >> stamp.h
|
||||||
|
@echo "#define VERSION_REVISION $(VERSION_REVISION)" >> stamp.h
|
||||||
|
@echo "#define GIT_STR \"$(shell git rev-parse HEAD)\"" >> stamp.h
|
||||||
|
|
||||||
|
opentx-stamp:
|
||||||
|
@echo "#define DATE_STR \"`date +%Y-%m-%d`\"" > stamp-opentx.txt
|
||||||
|
@echo "#define TIME_STR \"`date +%H:%M:%S`\"" >> stamp-opentx.txt
|
||||||
|
@echo "#define VERS_STR \"$(VERSION)\"" >> stamp-opentx.txt
|
||||||
|
@echo "#define GIT_STR \"$(shell git rev-parse HEAD)\"" >> stamp-opentx.txt
|
||||||
|
@cat stamp-opentx.txt
|
||||||
|
|
||||||
|
|
||||||
translations/en.h: translations/en.h.txt
|
translations/en.h: translations/en.h.txt
|
||||||
@echo
|
@echo
|
||||||
|
|
|
@ -81,22 +81,28 @@ Return OpenTX version
|
||||||
|
|
||||||
@retval string OpenTX version (ie "2.1.5")
|
@retval string OpenTX version (ie "2.1.5")
|
||||||
|
|
||||||
@retval list (available since 2.1.7) returns two values:
|
@retval multiple (available since 2.1.7) returns 5 values:
|
||||||
* `string` OpenTX version (ie "2.1.5")
|
* (string) OpenTX version (ie "2.1.5")
|
||||||
* `string` radio version: `taranisx9e`, `taranisplus` or `taranis`.
|
* (string) radio version: `taranisx9e`, `taranisplus` or `taranis`.
|
||||||
If running in simulator the "-simu" is added
|
If running in simulator the "-simu" is added
|
||||||
|
* (number) major version (ie 2 if version 2.1.5)
|
||||||
|
* (number) minor version (ie 1 if version 2.1.5)
|
||||||
|
* (number) revison number (ie 5 if version 2.1.5)
|
||||||
|
|
||||||
@status current Introduced in 2.0.0, expanded in 2.1.7
|
@status current Introduced in 2.0.0, expanded in 2.1.7
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
This example also runs in OpenTX versions where the radio version was not available:
|
This example also runs in OpenTX versions where the function returned only one value:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local function run(event)
|
local function run(event)
|
||||||
local ver, radio = getVersion()
|
local ver, radio, maj, minor, rev = getVersion()
|
||||||
print("version: "..ver)
|
print("version: "..ver)
|
||||||
if radio then print ("radio: "..radio) end
|
if radio then print ("radio: "..radio) end
|
||||||
|
if maj then print ("maj: "..maj) end
|
||||||
|
if minor then print ("minor: "..minor) end
|
||||||
|
if rev then print ("rev: "..rev) end
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -106,14 +112,19 @@ Output of the above script in simulator:
|
||||||
```
|
```
|
||||||
version: 2.1.7
|
version: 2.1.7
|
||||||
radio: taranis-simu
|
radio: taranis-simu
|
||||||
Script finished with status 1
|
maj: 2
|
||||||
|
minor: 1
|
||||||
|
rev: 7
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
static int luaGetVersion(lua_State *L)
|
static int luaGetVersion(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushstring(L, VERSION);
|
lua_pushstring(L, VERSION);
|
||||||
lua_pushstring(L, RADIO_VERSION);
|
lua_pushstring(L, RADIO_VERSION);
|
||||||
return 2;
|
lua_pushnumber(L, VERSION_MAJOR);
|
||||||
|
lua_pushnumber(L, VERSION_MINOR);
|
||||||
|
lua_pushnumber(L, VERSION_REVISION);
|
||||||
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*luadoc
|
/*luadoc
|
||||||
|
@ -168,20 +179,15 @@ static int luaGetDateTime(lua_State *L)
|
||||||
static void luaPushLatLon(TelemetrySensor & telemetrySensor, TelemetryItem & telemetryItem)
|
static void luaPushLatLon(TelemetrySensor & telemetrySensor, TelemetryItem & telemetryItem)
|
||||||
/* result is lua table containing members ["lat"] and ["lon"] as lua_Number (doubles) in decimal degrees */
|
/* result is lua table containing members ["lat"] and ["lon"] as lua_Number (doubles) in decimal degrees */
|
||||||
{
|
{
|
||||||
lua_Number lat = 0.0;
|
|
||||||
lua_Number lon = 0.0;
|
|
||||||
uint32_t gpsLat = 0;
|
uint32_t gpsLat = 0;
|
||||||
uint32_t gpsLon = 0;
|
uint32_t gpsLon = 0;
|
||||||
|
|
||||||
telemetryItem.gps.extractLatitudeLongitude(&gpsLat, &gpsLon); /* close, but not the format we want */
|
telemetryItem.gps.extractLatitudeLongitude(&gpsLat, &gpsLon); /* close, but not the format we want */
|
||||||
lat = gpsLat / 1000000.0;
|
|
||||||
if (telemetryItem.gps.latitudeNS == 'S') lat = -lat;
|
|
||||||
lon = gpsLon / 1000000.0;
|
|
||||||
if (telemetryItem.gps.longitudeEW == 'W') lon = -lon;
|
|
||||||
|
|
||||||
lua_createtable(L, 0, 2);
|
lua_createtable(L, 0, 4);
|
||||||
lua_pushtablenumber(L, "lat", lat);
|
lua_pushtablenumber(L, "lat", gpsLat / ((telemetryItem.gps.latitudeNS == 'S') ? -1000000.0 : 1000000.0));
|
||||||
lua_pushtablenumber(L, "lon", lon);
|
lua_pushtablenumber(L, "pilot-lat", telemetryItem.pilotLatitude / ((telemetryItem.gps.latitudeNS == 'S') ? -1000000.0 : 1000000.0));
|
||||||
|
lua_pushtablenumber(L, "lon", gpsLon / ((telemetryItem.gps.longitudeEW == 'W') ? -1000000.0 : 1000000.0));
|
||||||
|
lua_pushtablenumber(L, "pilot-lon", telemetryItem.pilotLongitude / ((telemetryItem.gps.longitudeEW == 'W') ? -1000000.0 : 1000000.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void luaPushTelemetryDateTime(TelemetrySensor & telemetrySensor, TelemetryItem & telemetryItem)
|
static void luaPushTelemetryDateTime(TelemetrySensor & telemetrySensor, TelemetryItem & telemetryItem)
|
||||||
|
@ -379,6 +385,8 @@ or a name (string) of the source.
|
||||||
@retval table GPS position is returned in a table:
|
@retval table GPS position is returned in a table:
|
||||||
* `lat` (number) latitude, positive is North
|
* `lat` (number) latitude, positive is North
|
||||||
* `lon` (number) longitude, positive is East
|
* `lon` (number) longitude, positive is East
|
||||||
|
* `pilot-lat` (number) pilot latitude, positive is North
|
||||||
|
* `pilot-lon` (number) pilot longitude, positive is East
|
||||||
|
|
||||||
@retval table GPS date/time, see getDateTime()
|
@retval table GPS date/time, see getDateTime()
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
#define DATE "@DATE@"
|
#define DATE "@DATE@"
|
||||||
#define TIME "@TIME@"
|
#define TIME "@TIME@"
|
||||||
#define VERSION "@VERSION@"
|
#define VERSION "@VERSION@"
|
||||||
|
|
||||||
|
#define VERSION_MAJOR @VERSION_MAJOR@
|
||||||
|
#define VERSION_MINOR @VERSION_MINOR@
|
||||||
|
#define VERSION_REVISION @VERSION_REVISION@
|
||||||
|
#define GIT_STR "@GIT_STR@"
|
||||||
|
|
|
@ -845,7 +845,7 @@ FRESULT f_open (FIL * fil, const TCHAR *name, BYTE flag)
|
||||||
fil->fs = (FATFS*)fopen(realPath, (flag & FA_WRITE) ? ((flag & FA_CREATE_ALWAYS) ? "wb+" : "ab+") : "rb+");
|
fil->fs = (FATFS*)fopen(realPath, (flag & FA_WRITE) ? ((flag & FA_CREATE_ALWAYS) ? "wb+" : "ab+") : "rb+");
|
||||||
fil->fptr = 0;
|
fil->fptr = 0;
|
||||||
if (fil->fs) {
|
if (fil->fs) {
|
||||||
TRACE("f_open(%s, %x) = %p", path, flag, (FILE*)fil->fs);
|
TRACE("f_open(%s, %x) = %p (FIL %p)", path, flag, fil->fs, fil);
|
||||||
return FR_OK;
|
return FR_OK;
|
||||||
}
|
}
|
||||||
TRACE("f_open(%s) = error %d (%s)", path, errno, strerror(errno));
|
TRACE("f_open(%s) = error %d (%s)", path, errno, strerror(errno));
|
||||||
|
@ -894,8 +894,9 @@ UINT f_size(FIL* fil)
|
||||||
|
|
||||||
FRESULT f_close (FIL * fil)
|
FRESULT f_close (FIL * fil)
|
||||||
{
|
{
|
||||||
if (fil && fil->fs) {
|
assert(fil);
|
||||||
TRACE("f_close(%p)", (FILE*)fil->fs);
|
TRACE("f_close(%p) (FIL:%p)", fil->fs, fil);
|
||||||
|
if (fil->fs) {
|
||||||
fclose((FILE*)fil->fs);
|
fclose((FILE*)fil->fs);
|
||||||
fil->fs = NULL;
|
fil->fs = NULL;
|
||||||
}
|
}
|
||||||
|
|
1
radio/src/thirdparty/Lua/src/lauxlib.h
vendored
1
radio/src/thirdparty/Lua/src/lauxlib.h
vendored
|
@ -28,6 +28,7 @@ extern const luaL_Reg baselib[];
|
||||||
extern const luaL_Reg mathlib[];
|
extern const luaL_Reg mathlib[];
|
||||||
extern const luaL_Reg bitlib[];
|
extern const luaL_Reg bitlib[];
|
||||||
extern const luaL_Reg iolib[];
|
extern const luaL_Reg iolib[];
|
||||||
|
extern const luaL_Reg strlib[];
|
||||||
|
|
||||||
extern const luaL_Reg opentxLib[];
|
extern const luaL_Reg opentxLib[];
|
||||||
extern const luaL_Reg lcdLib[];
|
extern const luaL_Reg lcdLib[];
|
||||||
|
|
1
radio/src/thirdparty/Lua/src/linit.c
vendored
1
radio/src/thirdparty/Lua/src/linit.c
vendored
|
@ -46,6 +46,7 @@ const luaR_table lua_rotable[] =
|
||||||
{LUA_MATHLIBNAME, mathlib, mathlib_vals},
|
{LUA_MATHLIBNAME, mathlib, mathlib_vals},
|
||||||
{LUA_BITLIBNAME, bitlib, NULL},
|
{LUA_BITLIBNAME, bitlib, NULL},
|
||||||
{LUA_IOLIBNAME, iolib, NULL},
|
{LUA_IOLIBNAME, iolib, NULL},
|
||||||
|
{LUA_STRLIBNAME, strlib, NULL},
|
||||||
{"lcd", lcdLib, NULL},
|
{"lcd", lcdLib, NULL},
|
||||||
{"model", modelLib, NULL},
|
{"model", modelLib, NULL},
|
||||||
{"__baselib", baselib, NULL},
|
{"__baselib", baselib, NULL},
|
||||||
|
|
29
radio/src/thirdparty/Lua/src/liolib.c
vendored
29
radio/src/thirdparty/Lua/src/liolib.c
vendored
|
@ -203,16 +203,17 @@ static int io_close (lua_State *L) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(USE_FATFS)
|
|
||||||
static int f_gc (lua_State *L) {
|
static int f_gc (lua_State *L) {
|
||||||
#if !defined(USE_FATFS)
|
#if !defined(USE_FATFS)
|
||||||
LStream *p = tolstream(L);
|
LStream *p = tolstream(L);
|
||||||
if (!isclosed(p) && p->f != NULL)
|
if (!isclosed(p) && p->f != NULL)
|
||||||
aux_close(L); /* ignore closed and incompletely open files */
|
aux_close(L); /* ignore closed and incompletely open files */
|
||||||
#endif
|
#endif
|
||||||
|
f_close(tofile(L)); // no need to check if file was already closed (fatfs will not close it if p->f->fs is 0)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(USE_FATFS)
|
||||||
/*
|
/*
|
||||||
** function to close regular files
|
** function to close regular files
|
||||||
*/
|
*/
|
||||||
|
@ -659,31 +660,27 @@ const luaL_Reg iolib[] = {
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(USE_FATFS)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** methods for file handles
|
** methods for file handles
|
||||||
*/
|
*/
|
||||||
static const luaL_Reg flib[] = {
|
static const luaL_Reg flib[] = {
|
||||||
{"close", io_close},
|
// {"close", io_close},
|
||||||
{"flush", f_flush},
|
// {"flush", f_flush},
|
||||||
{"lines", f_lines},
|
// {"lines", f_lines},
|
||||||
{"read", io_read},
|
// {"read", io_read},
|
||||||
{"seek", f_seek},
|
// {"seek", f_seek},
|
||||||
{"setvbuf", f_setvbuf},
|
// {"setvbuf", f_setvbuf},
|
||||||
{"write", f_write},
|
// {"write", f_write},
|
||||||
{"__gc", f_gc},
|
{"__gc", f_gc}, // we define only garbage collector to close any leftover open files
|
||||||
{"__tostring", f_tostring},
|
// {"__tostring", f_tostring},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void createmeta (lua_State *L) {
|
static void createmeta (lua_State *L) {
|
||||||
luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */
|
luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */
|
||||||
lua_pushvalue(L, -1); /* push metatable */
|
lua_pushvalue(L, -1); /* push metatable */
|
||||||
// lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */
|
lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */
|
||||||
// luaL_setfuncs(L, flib, 0); /* add file methods to new metatable */
|
luaL_setfuncs(L, flib, 0); /* add file methods to new metatable */
|
||||||
lua_pop(L, 1); /* pop new metatable */
|
lua_pop(L, 1); /* pop new metatable */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
radio/src/thirdparty/Lua/src/lstrlib.c
vendored
7
radio/src/thirdparty/Lua/src/lstrlib.c
vendored
|
@ -9,6 +9,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define lstrlib_c
|
#define lstrlib_c
|
||||||
|
|
||||||
|
@ -975,7 +976,7 @@ static int str_format (lua_State *L) {
|
||||||
/* }====================================================== */
|
/* }====================================================== */
|
||||||
|
|
||||||
|
|
||||||
static const luaL_Reg strlib[] = {
|
const luaL_Reg strlib[] = {
|
||||||
{"byte", str_byte},
|
{"byte", str_byte},
|
||||||
{"char", str_char},
|
{"char", str_char},
|
||||||
{"dump", str_dump},
|
{"dump", str_dump},
|
||||||
|
@ -993,7 +994,7 @@ static const luaL_Reg strlib[] = {
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void createmetatable (lua_State *L) {
|
static void createmetatable (lua_State *L) {
|
||||||
lua_createtable(L, 0, 1); /* table to be metatable for strings */
|
lua_createtable(L, 0, 1); /* table to be metatable for strings */
|
||||||
lua_pushliteral(L, ""); /* dummy string */
|
lua_pushliteral(L, ""); /* dummy string */
|
||||||
|
@ -1014,4 +1015,4 @@ LUAMOD_API int luaopen_string (lua_State *L) {
|
||||||
createmetatable(L);
|
createmetatable(L);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue